diff --git a/CHANGELOG.md b/CHANGELOG.md index acfe7ad56..7e54a7ce1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # CHANGELOG +## v0.4.19 + +FEATURE: Reserved shares now support unique names ("vanity tokens"). This allows for the creation of reserved shares with identifiable names rather than generated share tokens. Includes basic support for profanity checking (https://github.com/openziti/zrok/issues/401) + +CHANGE: The Python SDK has been updated to properly support the "reserved" flag on the `ShareRequest` passed to `CreateShare` + ## v0.4.18 FEATURE: Python SDK added. Can be found on [pypi](https://test.pypi.org/project/zrok-sdk). `pastebin` example illustrates basic SDK usage (see `sdk/python/examples/README.md` for details) (https://github.com/openziti/zrok/issues/401) diff --git a/cmd/zrok/reserve.go b/cmd/zrok/reserve.go index 5eab436be..cb1ae2d89 100644 --- a/cmd/zrok/reserve.go +++ b/cmd/zrok/reserve.go @@ -6,6 +6,7 @@ import ( "github.com/openziti/zrok/environment" "github.com/openziti/zrok/sdk/golang/sdk" "github.com/openziti/zrok/tui" + "github.com/openziti/zrok/util" "github.com/sirupsen/logrus" "github.com/spf13/cobra" "slices" @@ -17,6 +18,7 @@ func init() { } type reserveCommand struct { + uniqueName string basicAuth []string frontendSelection []string backendMode string @@ -34,6 +36,7 @@ func newReserveCommand() *reserveCommand { Args: cobra.ExactArgs(2), } command := &reserveCommand{cmd: cmd} + cmd.Flags().StringVarP(&command.uniqueName, "unique-name", "n", "", "A unique name for the reserved share (defaults to generated identifier)") cmd.Flags().StringArrayVar(&command.frontendSelection, "frontends", []string{"public"}, "Selected frontends to use for the share") cmd.Flags().StringVarP(&command.backendMode, "backend-mode", "b", "proxy", "The backend mode (public|private: proxy, web, caddy, drive) (private: tcpTunnel, udpTunnel)") cmd.Flags().BoolVarP(&command.jsonOutput, "json-output", "j", false, "Emit JSON describing the created reserved share") @@ -56,6 +59,10 @@ func (cmd *reserveCommand) run(_ *cobra.Command, args []string) { tui.Error(fmt.Sprintf("invalid sharing mode for a %s share: %s", sdk.PublicShareMode, cmd.backendMode), nil) } + if cmd.uniqueName != "" && !util.IsValidUniqueName(cmd.uniqueName) { + tui.Error("invalid unique name; must be lowercase alphanumeric, between 4 and 32 characters in length, screened for profanity", nil) + } + var target string switch cmd.backendMode { case "proxy": @@ -95,6 +102,7 @@ func (cmd *reserveCommand) run(_ *cobra.Command, args []string) { req := &sdk.ShareRequest{ Reserved: true, + UniqueName: cmd.uniqueName, BackendMode: sdk.BackendMode(cmd.backendMode), ShareMode: shareMode, BasicAuth: cmd.basicAuth, diff --git a/controller/share.go b/controller/share.go index bcf363601..dbb22c2ef 100644 --- a/controller/share.go +++ b/controller/share.go @@ -8,6 +8,7 @@ import ( "github.com/openziti/zrok/rest_model_zrok" "github.com/openziti/zrok/rest_server_zrok/operations/share" "github.com/openziti/zrok/sdk/golang/sdk" + "github.com/openziti/zrok/util" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -33,14 +34,14 @@ func (h *shareHandler) Handle(params share.ShareParams, principal *rest_model_zr found := false for _, env := range envs { if env.ZId == envZId { - logrus.Debugf("found identity '%v' for user '%v'", envZId, principal.Email) + logrus.Debugf("found identity '%v' for account '%v'", envZId, principal.Email) envId = env.Id found = true break } } if !found { - logrus.Errorf("environment '%v' not found for user '%v'", envZId, principal.Email) + logrus.Errorf("environment '%v' not found for account '%v'", envZId, principal.Email) return share.NewShareUnauthorized() } } else { @@ -58,11 +59,21 @@ func (h *shareHandler) Handle(params share.ShareParams, principal *rest_model_zr logrus.Error(err) return share.NewShareInternalServerError() } + + reserved := params.Body.Reserved + uniqueName := params.Body.UniqueName shrToken, err := createShareToken() if err != nil { logrus.Error(err) return share.NewShareInternalServerError() } + if reserved && uniqueName != "" { + if !util.IsValidUniqueName(uniqueName) { + logrus.Errorf("invalid unique name '%v' for account '%v'", uniqueName, principal.Email) + return share.NewShareUnprocessableEntity() + } + shrToken = uniqueName + } var shrZId string var frontendEndpoints []string @@ -94,7 +105,6 @@ func (h *shareHandler) Handle(params share.ShareParams, principal *rest_model_zr } case string(sdk.PrivateShareMode): - logrus.Info("doing private") shrZId, frontendEndpoints, err = newPrivateResourceAllocator().allocate(envZId, shrToken, params, edge) if err != nil { logrus.Error(err) @@ -108,7 +118,6 @@ func (h *shareHandler) Handle(params share.ShareParams, principal *rest_model_zr logrus.Debugf("allocated share '%v'", shrToken) - reserved := params.Body.Reserved sshr := &store.Share{ ZId: shrZId, Token: shrToken, diff --git a/controller/store/sql/postgresql/015_v0_4_19_share_unique_name_constraint.sql b/controller/store/sql/postgresql/015_v0_4_19_share_unique_name_constraint.sql new file mode 100644 index 000000000..42f017431 --- /dev/null +++ b/controller/store/sql/postgresql/015_v0_4_19_share_unique_name_constraint.sql @@ -0,0 +1,7 @@ +-- +migrate Up + +-- remove the old unique index (which did not respect the deleted flag) +ALTER TABLE shares DROP CONSTRAINT shares_token_key; + +-- add a new unique index which only constrains uniqueness for not-deleted rows +CREATE UNIQUE INDEX shares_token_idx ON shares(token) WHERE deleted is false; diff --git a/controller/store/sql/sqlite3/015_v0_4_19_share_unique_name_constraint.sql b/controller/store/sql/sqlite3/015_v0_4_19_share_unique_name_constraint.sql new file mode 100644 index 000000000..9d60476ce --- /dev/null +++ b/controller/store/sql/sqlite3/015_v0_4_19_share_unique_name_constraint.sql @@ -0,0 +1,55 @@ +-- +migrate Up + +alter table shares rename to shares_old; +create table shares ( + id integer primary key, + environment_id integer constraint fk_environments_shares references environments on delete cascade, + z_id string not null unique, + token string not null, + share_mode string not null, + backend_mode string not null, + frontend_selection string, + frontend_endpoint string, + backend_proxy_endpoint string, + reserved boolean not null default(false), + created_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')), + updated_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')), deleted boolean not null default(false), + + constraint chk_z_id check (z_id <> ''), + constraint chk_token check (token <> ''), + constraint chk_share_mode check (share_mode == 'public' or share_mode == 'private'), + constraint chk_backend_mode check (backend_mode == 'proxy' or backend_mode == 'web' or backend_mode == 'tcpTunnel' or backend_mode == 'udpTunnel' or backend_mode == 'caddy' or backend_mode == 'drive') +); +CREATE UNIQUE INDEX shares_token_idx ON shares(token) WHERE deleted is false; +insert into shares select * from shares_old; +drop table shares_old; + +alter table frontends rename to frontends_old; +create table frontends ( + id integer primary key, + environment_id integer references environments(id), + token varchar(32) not null unique, + z_id varchar(32) not null, + public_name varchar(64) unique, + url_template varchar(1024), + reserved boolean not null default(false), + created_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')), + updated_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')), + deleted boolean not null default(false), + private_share_id integer references shares(id) +); +insert into frontends select * from frontends_old; +drop table frontends_old; + +alter table share_limit_journal rename to share_limit_journal_old; +create table share_limit_journal ( + id integer primary key, + share_id integer references shares(id), + rx_bytes bigint not null, + tx_bytes bigint not null, + action limit_action_type not null, + created_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')), + updated_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')) +); +insert into share_limit_journal select * from share_limit_journal_old; +drop table share_limit_journal_old; \ No newline at end of file diff --git a/go.mod b/go.mod index ab9fdf36b..41b833c52 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/openziti/zrok go 1.20 require ( + github.com/TwiN/go-away v1.6.12 github.com/caddyserver/caddy/v2 v2.7.5-0.20230829153420-ed8bb13c5df7 github.com/charmbracelet/bubbles v0.14.0 github.com/charmbracelet/bubbletea v0.23.1 @@ -226,7 +227,7 @@ require ( golang.org/x/sync v0.3.0 // indirect golang.org/x/sys v0.11.0 // indirect golang.org/x/term v0.11.0 // indirect - golang.org/x/text v0.12.0 // indirect + golang.org/x/text v0.14.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130 // indirect diff --git a/go.sum b/go.sum index c1454c49a..65c9312d8 100644 --- a/go.sum +++ b/go.sum @@ -114,6 +114,8 @@ github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbt github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/TwiN/go-away v1.6.12 h1:80AjDyeTjfQaSFYbALzRcDKMAmxKW0a5PoxwXKZlW2A= +github.com/TwiN/go-away v1.6.12/go.mod h1:MpvIC9Li3minq+CGgbgUDvQ9tDaeW35k5IXZrF9MVas= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs= @@ -1792,8 +1794,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/rest_client_zrok/account/invite_responses.go b/rest_client_zrok/account/invite_responses.go index 87d13542d..a07d98a30 100644 --- a/rest_client_zrok/account/invite_responses.go +++ b/rest_client_zrok/account/invite_responses.go @@ -48,7 +48,7 @@ func (o *InviteReader) ReadResponse(response runtime.ClientResponse, consumer ru } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[POST /invite] invite", response, response.Code()) } } @@ -90,6 +90,11 @@ func (o *InviteCreated) IsCode(code int) bool { return code == 201 } +// Code gets the status code for the invite created response +func (o *InviteCreated) Code() int { + return 201 +} + func (o *InviteCreated) Error() string { return fmt.Sprintf("[POST /invite][%d] inviteCreated ", 201) } @@ -142,6 +147,11 @@ func (o *InviteBadRequest) IsCode(code int) bool { return code == 400 } +// Code gets the status code for the invite bad request response +func (o *InviteBadRequest) Code() int { + return 400 +} + func (o *InviteBadRequest) Error() string { return fmt.Sprintf("[POST /invite][%d] inviteBadRequest %+v", 400, o.Payload) } @@ -202,6 +212,11 @@ func (o *InviteUnauthorized) IsCode(code int) bool { return code == 401 } +// Code gets the status code for the invite unauthorized response +func (o *InviteUnauthorized) Code() int { + return 401 +} + func (o *InviteUnauthorized) Error() string { return fmt.Sprintf("[POST /invite][%d] inviteUnauthorized ", 401) } @@ -253,6 +268,11 @@ func (o *InviteInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the invite internal server error response +func (o *InviteInternalServerError) Code() int { + return 500 +} + func (o *InviteInternalServerError) Error() string { return fmt.Sprintf("[POST /invite][%d] inviteInternalServerError ", 500) } diff --git a/rest_client_zrok/account/login_responses.go b/rest_client_zrok/account/login_responses.go index 08ef25b82..534f6a4f3 100644 --- a/rest_client_zrok/account/login_responses.go +++ b/rest_client_zrok/account/login_responses.go @@ -36,7 +36,7 @@ func (o *LoginReader) ReadResponse(response runtime.ClientResponse, consumer run } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[POST /login] login", response, response.Code()) } } @@ -79,6 +79,11 @@ func (o *LoginOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the login o k response +func (o *LoginOK) Code() int { + return 200 +} + func (o *LoginOK) Error() string { return fmt.Sprintf("[POST /login][%d] loginOK %+v", 200, o.Payload) } @@ -139,6 +144,11 @@ func (o *LoginUnauthorized) IsCode(code int) bool { return code == 401 } +// Code gets the status code for the login unauthorized response +func (o *LoginUnauthorized) Code() int { + return 401 +} + func (o *LoginUnauthorized) Error() string { return fmt.Sprintf("[POST /login][%d] loginUnauthorized ", 401) } diff --git a/rest_client_zrok/account/register_responses.go b/rest_client_zrok/account/register_responses.go index 82225bbeb..2c510334e 100644 --- a/rest_client_zrok/account/register_responses.go +++ b/rest_client_zrok/account/register_responses.go @@ -48,7 +48,7 @@ func (o *RegisterReader) ReadResponse(response runtime.ClientResponse, consumer } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[POST /register] register", response, response.Code()) } } @@ -91,6 +91,11 @@ func (o *RegisterOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the register o k response +func (o *RegisterOK) Code() int { + return 200 +} + func (o *RegisterOK) Error() string { return fmt.Sprintf("[POST /register][%d] registerOK %+v", 200, o.Payload) } @@ -153,6 +158,11 @@ func (o *RegisterNotFound) IsCode(code int) bool { return code == 404 } +// Code gets the status code for the register not found response +func (o *RegisterNotFound) Code() int { + return 404 +} + func (o *RegisterNotFound) Error() string { return fmt.Sprintf("[POST /register][%d] registerNotFound ", 404) } @@ -205,6 +215,11 @@ func (o *RegisterUnprocessableEntity) IsCode(code int) bool { return code == 422 } +// Code gets the status code for the register unprocessable entity response +func (o *RegisterUnprocessableEntity) Code() int { + return 422 +} + func (o *RegisterUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /register][%d] registerUnprocessableEntity %+v", 422, o.Payload) } @@ -265,6 +280,11 @@ func (o *RegisterInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the register internal server error response +func (o *RegisterInternalServerError) Code() int { + return 500 +} + func (o *RegisterInternalServerError) Error() string { return fmt.Sprintf("[POST /register][%d] registerInternalServerError ", 500) } diff --git a/rest_client_zrok/account/reset_password_request_responses.go b/rest_client_zrok/account/reset_password_request_responses.go index 2f0bb971a..7e05c525a 100644 --- a/rest_client_zrok/account/reset_password_request_responses.go +++ b/rest_client_zrok/account/reset_password_request_responses.go @@ -41,7 +41,7 @@ func (o *ResetPasswordRequestReader) ReadResponse(response runtime.ClientRespons } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[POST /resetPasswordRequest] resetPasswordRequest", response, response.Code()) } } @@ -83,6 +83,11 @@ func (o *ResetPasswordRequestCreated) IsCode(code int) bool { return code == 201 } +// Code gets the status code for the reset password request created response +func (o *ResetPasswordRequestCreated) Code() int { + return 201 +} + func (o *ResetPasswordRequestCreated) Error() string { return fmt.Sprintf("[POST /resetPasswordRequest][%d] resetPasswordRequestCreated ", 201) } @@ -134,6 +139,11 @@ func (o *ResetPasswordRequestBadRequest) IsCode(code int) bool { return code == 400 } +// Code gets the status code for the reset password request bad request response +func (o *ResetPasswordRequestBadRequest) Code() int { + return 400 +} + func (o *ResetPasswordRequestBadRequest) Error() string { return fmt.Sprintf("[POST /resetPasswordRequest][%d] resetPasswordRequestBadRequest ", 400) } @@ -185,6 +195,11 @@ func (o *ResetPasswordRequestInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the reset password request internal server error response +func (o *ResetPasswordRequestInternalServerError) Code() int { + return 500 +} + func (o *ResetPasswordRequestInternalServerError) Error() string { return fmt.Sprintf("[POST /resetPasswordRequest][%d] resetPasswordRequestInternalServerError ", 500) } diff --git a/rest_client_zrok/account/reset_password_responses.go b/rest_client_zrok/account/reset_password_responses.go index fb106b41c..01c83c7be 100644 --- a/rest_client_zrok/account/reset_password_responses.go +++ b/rest_client_zrok/account/reset_password_responses.go @@ -48,7 +48,7 @@ func (o *ResetPasswordReader) ReadResponse(response runtime.ClientResponse, cons } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[POST /resetPassword] resetPassword", response, response.Code()) } } @@ -90,6 +90,11 @@ func (o *ResetPasswordOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the reset password o k response +func (o *ResetPasswordOK) Code() int { + return 200 +} + func (o *ResetPasswordOK) Error() string { return fmt.Sprintf("[POST /resetPassword][%d] resetPasswordOK ", 200) } @@ -141,6 +146,11 @@ func (o *ResetPasswordNotFound) IsCode(code int) bool { return code == 404 } +// Code gets the status code for the reset password not found response +func (o *ResetPasswordNotFound) Code() int { + return 404 +} + func (o *ResetPasswordNotFound) Error() string { return fmt.Sprintf("[POST /resetPassword][%d] resetPasswordNotFound ", 404) } @@ -193,6 +203,11 @@ func (o *ResetPasswordUnprocessableEntity) IsCode(code int) bool { return code == 422 } +// Code gets the status code for the reset password unprocessable entity response +func (o *ResetPasswordUnprocessableEntity) Code() int { + return 422 +} + func (o *ResetPasswordUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /resetPassword][%d] resetPasswordUnprocessableEntity %+v", 422, o.Payload) } @@ -253,6 +268,11 @@ func (o *ResetPasswordInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the reset password internal server error response +func (o *ResetPasswordInternalServerError) Code() int { + return 500 +} + func (o *ResetPasswordInternalServerError) Error() string { return fmt.Sprintf("[POST /resetPassword][%d] resetPasswordInternalServerError ", 500) } diff --git a/rest_client_zrok/account/verify_responses.go b/rest_client_zrok/account/verify_responses.go index f333aeaaf..ee26b595d 100644 --- a/rest_client_zrok/account/verify_responses.go +++ b/rest_client_zrok/account/verify_responses.go @@ -42,7 +42,7 @@ func (o *VerifyReader) ReadResponse(response runtime.ClientResponse, consumer ru } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[POST /verify] verify", response, response.Code()) } } @@ -85,6 +85,11 @@ func (o *VerifyOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the verify o k response +func (o *VerifyOK) Code() int { + return 200 +} + func (o *VerifyOK) Error() string { return fmt.Sprintf("[POST /verify][%d] verifyOK %+v", 200, o.Payload) } @@ -147,6 +152,11 @@ func (o *VerifyNotFound) IsCode(code int) bool { return code == 404 } +// Code gets the status code for the verify not found response +func (o *VerifyNotFound) Code() int { + return 404 +} + func (o *VerifyNotFound) Error() string { return fmt.Sprintf("[POST /verify][%d] verifyNotFound ", 404) } @@ -198,6 +208,11 @@ func (o *VerifyInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the verify internal server error response +func (o *VerifyInternalServerError) Code() int { + return 500 +} + func (o *VerifyInternalServerError) Error() string { return fmt.Sprintf("[POST /verify][%d] verifyInternalServerError ", 500) } diff --git a/rest_client_zrok/admin/create_frontend_responses.go b/rest_client_zrok/admin/create_frontend_responses.go index 35689cc5f..69423f998 100644 --- a/rest_client_zrok/admin/create_frontend_responses.go +++ b/rest_client_zrok/admin/create_frontend_responses.go @@ -54,7 +54,7 @@ func (o *CreateFrontendReader) ReadResponse(response runtime.ClientResponse, con } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[POST /frontend] createFrontend", response, response.Code()) } } @@ -97,6 +97,11 @@ func (o *CreateFrontendCreated) IsCode(code int) bool { return code == 201 } +// Code gets the status code for the create frontend created response +func (o *CreateFrontendCreated) Code() int { + return 201 +} + func (o *CreateFrontendCreated) Error() string { return fmt.Sprintf("[POST /frontend][%d] createFrontendCreated %+v", 201, o.Payload) } @@ -159,6 +164,11 @@ func (o *CreateFrontendBadRequest) IsCode(code int) bool { return code == 400 } +// Code gets the status code for the create frontend bad request response +func (o *CreateFrontendBadRequest) Code() int { + return 400 +} + func (o *CreateFrontendBadRequest) Error() string { return fmt.Sprintf("[POST /frontend][%d] createFrontendBadRequest ", 400) } @@ -210,6 +220,11 @@ func (o *CreateFrontendUnauthorized) IsCode(code int) bool { return code == 401 } +// Code gets the status code for the create frontend unauthorized response +func (o *CreateFrontendUnauthorized) Code() int { + return 401 +} + func (o *CreateFrontendUnauthorized) Error() string { return fmt.Sprintf("[POST /frontend][%d] createFrontendUnauthorized ", 401) } @@ -261,6 +276,11 @@ func (o *CreateFrontendNotFound) IsCode(code int) bool { return code == 404 } +// Code gets the status code for the create frontend not found response +func (o *CreateFrontendNotFound) Code() int { + return 404 +} + func (o *CreateFrontendNotFound) Error() string { return fmt.Sprintf("[POST /frontend][%d] createFrontendNotFound ", 404) } @@ -312,6 +332,11 @@ func (o *CreateFrontendInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the create frontend internal server error response +func (o *CreateFrontendInternalServerError) Code() int { + return 500 +} + func (o *CreateFrontendInternalServerError) Error() string { return fmt.Sprintf("[POST /frontend][%d] createFrontendInternalServerError ", 500) } diff --git a/rest_client_zrok/admin/create_identity_responses.go b/rest_client_zrok/admin/create_identity_responses.go index b41af2098..17c7457b0 100644 --- a/rest_client_zrok/admin/create_identity_responses.go +++ b/rest_client_zrok/admin/create_identity_responses.go @@ -42,7 +42,7 @@ func (o *CreateIdentityReader) ReadResponse(response runtime.ClientResponse, con } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[POST /identity] createIdentity", response, response.Code()) } } @@ -85,6 +85,11 @@ func (o *CreateIdentityCreated) IsCode(code int) bool { return code == 201 } +// Code gets the status code for the create identity created response +func (o *CreateIdentityCreated) Code() int { + return 201 +} + func (o *CreateIdentityCreated) Error() string { return fmt.Sprintf("[POST /identity][%d] createIdentityCreated %+v", 201, o.Payload) } @@ -147,6 +152,11 @@ func (o *CreateIdentityUnauthorized) IsCode(code int) bool { return code == 401 } +// Code gets the status code for the create identity unauthorized response +func (o *CreateIdentityUnauthorized) Code() int { + return 401 +} + func (o *CreateIdentityUnauthorized) Error() string { return fmt.Sprintf("[POST /identity][%d] createIdentityUnauthorized ", 401) } @@ -198,6 +208,11 @@ func (o *CreateIdentityInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the create identity internal server error response +func (o *CreateIdentityInternalServerError) Code() int { + return 500 +} + func (o *CreateIdentityInternalServerError) Error() string { return fmt.Sprintf("[POST /identity][%d] createIdentityInternalServerError ", 500) } diff --git a/rest_client_zrok/admin/delete_frontend_responses.go b/rest_client_zrok/admin/delete_frontend_responses.go index 209428357..4c37fb23b 100644 --- a/rest_client_zrok/admin/delete_frontend_responses.go +++ b/rest_client_zrok/admin/delete_frontend_responses.go @@ -45,7 +45,7 @@ func (o *DeleteFrontendReader) ReadResponse(response runtime.ClientResponse, con } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[DELETE /frontend] deleteFrontend", response, response.Code()) } } @@ -87,6 +87,11 @@ func (o *DeleteFrontendOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the delete frontend o k response +func (o *DeleteFrontendOK) Code() int { + return 200 +} + func (o *DeleteFrontendOK) Error() string { return fmt.Sprintf("[DELETE /frontend][%d] deleteFrontendOK ", 200) } @@ -138,6 +143,11 @@ func (o *DeleteFrontendUnauthorized) IsCode(code int) bool { return code == 401 } +// Code gets the status code for the delete frontend unauthorized response +func (o *DeleteFrontendUnauthorized) Code() int { + return 401 +} + func (o *DeleteFrontendUnauthorized) Error() string { return fmt.Sprintf("[DELETE /frontend][%d] deleteFrontendUnauthorized ", 401) } @@ -189,6 +199,11 @@ func (o *DeleteFrontendNotFound) IsCode(code int) bool { return code == 404 } +// Code gets the status code for the delete frontend not found response +func (o *DeleteFrontendNotFound) Code() int { + return 404 +} + func (o *DeleteFrontendNotFound) Error() string { return fmt.Sprintf("[DELETE /frontend][%d] deleteFrontendNotFound ", 404) } @@ -240,6 +255,11 @@ func (o *DeleteFrontendInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the delete frontend internal server error response +func (o *DeleteFrontendInternalServerError) Code() int { + return 500 +} + func (o *DeleteFrontendInternalServerError) Error() string { return fmt.Sprintf("[DELETE /frontend][%d] deleteFrontendInternalServerError ", 500) } diff --git a/rest_client_zrok/admin/invite_token_generate_responses.go b/rest_client_zrok/admin/invite_token_generate_responses.go index c1394db84..c2c61e651 100644 --- a/rest_client_zrok/admin/invite_token_generate_responses.go +++ b/rest_client_zrok/admin/invite_token_generate_responses.go @@ -45,7 +45,7 @@ func (o *InviteTokenGenerateReader) ReadResponse(response runtime.ClientResponse } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[POST /invite/token/generate] inviteTokenGenerate", response, response.Code()) } } @@ -87,6 +87,11 @@ func (o *InviteTokenGenerateCreated) IsCode(code int) bool { return code == 201 } +// Code gets the status code for the invite token generate created response +func (o *InviteTokenGenerateCreated) Code() int { + return 201 +} + func (o *InviteTokenGenerateCreated) Error() string { return fmt.Sprintf("[POST /invite/token/generate][%d] inviteTokenGenerateCreated ", 201) } @@ -138,6 +143,11 @@ func (o *InviteTokenGenerateBadRequest) IsCode(code int) bool { return code == 400 } +// Code gets the status code for the invite token generate bad request response +func (o *InviteTokenGenerateBadRequest) Code() int { + return 400 +} + func (o *InviteTokenGenerateBadRequest) Error() string { return fmt.Sprintf("[POST /invite/token/generate][%d] inviteTokenGenerateBadRequest ", 400) } @@ -189,6 +199,11 @@ func (o *InviteTokenGenerateUnauthorized) IsCode(code int) bool { return code == 401 } +// Code gets the status code for the invite token generate unauthorized response +func (o *InviteTokenGenerateUnauthorized) Code() int { + return 401 +} + func (o *InviteTokenGenerateUnauthorized) Error() string { return fmt.Sprintf("[POST /invite/token/generate][%d] inviteTokenGenerateUnauthorized ", 401) } @@ -240,6 +255,11 @@ func (o *InviteTokenGenerateInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the invite token generate internal server error response +func (o *InviteTokenGenerateInternalServerError) Code() int { + return 500 +} + func (o *InviteTokenGenerateInternalServerError) Error() string { return fmt.Sprintf("[POST /invite/token/generate][%d] inviteTokenGenerateInternalServerError ", 500) } diff --git a/rest_client_zrok/admin/list_frontends_responses.go b/rest_client_zrok/admin/list_frontends_responses.go index fe9d15fb5..e03e7d178 100644 --- a/rest_client_zrok/admin/list_frontends_responses.go +++ b/rest_client_zrok/admin/list_frontends_responses.go @@ -42,7 +42,7 @@ func (o *ListFrontendsReader) ReadResponse(response runtime.ClientResponse, cons } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[GET /frontends] listFrontends", response, response.Code()) } } @@ -85,6 +85,11 @@ func (o *ListFrontendsOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the list frontends o k response +func (o *ListFrontendsOK) Code() int { + return 200 +} + func (o *ListFrontendsOK) Error() string { return fmt.Sprintf("[GET /frontends][%d] listFrontendsOK %+v", 200, o.Payload) } @@ -145,6 +150,11 @@ func (o *ListFrontendsUnauthorized) IsCode(code int) bool { return code == 401 } +// Code gets the status code for the list frontends unauthorized response +func (o *ListFrontendsUnauthorized) Code() int { + return 401 +} + func (o *ListFrontendsUnauthorized) Error() string { return fmt.Sprintf("[GET /frontends][%d] listFrontendsUnauthorized ", 401) } @@ -196,6 +206,11 @@ func (o *ListFrontendsInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the list frontends internal server error response +func (o *ListFrontendsInternalServerError) Code() int { + return 500 +} + func (o *ListFrontendsInternalServerError) Error() string { return fmt.Sprintf("[GET /frontends][%d] listFrontendsInternalServerError ", 500) } diff --git a/rest_client_zrok/admin/update_frontend_responses.go b/rest_client_zrok/admin/update_frontend_responses.go index f267e101f..f1c633be4 100644 --- a/rest_client_zrok/admin/update_frontend_responses.go +++ b/rest_client_zrok/admin/update_frontend_responses.go @@ -45,7 +45,7 @@ func (o *UpdateFrontendReader) ReadResponse(response runtime.ClientResponse, con } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[PATCH /frontend] updateFrontend", response, response.Code()) } } @@ -87,6 +87,11 @@ func (o *UpdateFrontendOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the update frontend o k response +func (o *UpdateFrontendOK) Code() int { + return 200 +} + func (o *UpdateFrontendOK) Error() string { return fmt.Sprintf("[PATCH /frontend][%d] updateFrontendOK ", 200) } @@ -138,6 +143,11 @@ func (o *UpdateFrontendUnauthorized) IsCode(code int) bool { return code == 401 } +// Code gets the status code for the update frontend unauthorized response +func (o *UpdateFrontendUnauthorized) Code() int { + return 401 +} + func (o *UpdateFrontendUnauthorized) Error() string { return fmt.Sprintf("[PATCH /frontend][%d] updateFrontendUnauthorized ", 401) } @@ -189,6 +199,11 @@ func (o *UpdateFrontendNotFound) IsCode(code int) bool { return code == 404 } +// Code gets the status code for the update frontend not found response +func (o *UpdateFrontendNotFound) Code() int { + return 404 +} + func (o *UpdateFrontendNotFound) Error() string { return fmt.Sprintf("[PATCH /frontend][%d] updateFrontendNotFound ", 404) } @@ -240,6 +255,11 @@ func (o *UpdateFrontendInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the update frontend internal server error response +func (o *UpdateFrontendInternalServerError) Code() int { + return 500 +} + func (o *UpdateFrontendInternalServerError) Error() string { return fmt.Sprintf("[PATCH /frontend][%d] updateFrontendInternalServerError ", 500) } diff --git a/rest_client_zrok/environment/disable_responses.go b/rest_client_zrok/environment/disable_responses.go index 7fd6a29db..60fb2fa94 100644 --- a/rest_client_zrok/environment/disable_responses.go +++ b/rest_client_zrok/environment/disable_responses.go @@ -39,7 +39,7 @@ func (o *DisableReader) ReadResponse(response runtime.ClientResponse, consumer r } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[POST /disable] disable", response, response.Code()) } } @@ -81,6 +81,11 @@ func (o *DisableOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the disable o k response +func (o *DisableOK) Code() int { + return 200 +} + func (o *DisableOK) Error() string { return fmt.Sprintf("[POST /disable][%d] disableOK ", 200) } @@ -132,6 +137,11 @@ func (o *DisableUnauthorized) IsCode(code int) bool { return code == 401 } +// Code gets the status code for the disable unauthorized response +func (o *DisableUnauthorized) Code() int { + return 401 +} + func (o *DisableUnauthorized) Error() string { return fmt.Sprintf("[POST /disable][%d] disableUnauthorized ", 401) } @@ -183,6 +193,11 @@ func (o *DisableInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the disable internal server error response +func (o *DisableInternalServerError) Code() int { + return 500 +} + func (o *DisableInternalServerError) Error() string { return fmt.Sprintf("[POST /disable][%d] disableInternalServerError ", 500) } diff --git a/rest_client_zrok/environment/enable_responses.go b/rest_client_zrok/environment/enable_responses.go index 7a3c461a7..a79daa5a2 100644 --- a/rest_client_zrok/environment/enable_responses.go +++ b/rest_client_zrok/environment/enable_responses.go @@ -48,7 +48,7 @@ func (o *EnableReader) ReadResponse(response runtime.ClientResponse, consumer ru } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[POST /enable] enable", response, response.Code()) } } @@ -91,6 +91,11 @@ func (o *EnableCreated) IsCode(code int) bool { return code == 201 } +// Code gets the status code for the enable created response +func (o *EnableCreated) Code() int { + return 201 +} + func (o *EnableCreated) Error() string { return fmt.Sprintf("[POST /enable][%d] enableCreated %+v", 201, o.Payload) } @@ -153,6 +158,11 @@ func (o *EnableUnauthorized) IsCode(code int) bool { return code == 401 } +// Code gets the status code for the enable unauthorized response +func (o *EnableUnauthorized) Code() int { + return 401 +} + func (o *EnableUnauthorized) Error() string { return fmt.Sprintf("[POST /enable][%d] enableUnauthorized ", 401) } @@ -204,6 +214,11 @@ func (o *EnableNotFound) IsCode(code int) bool { return code == 404 } +// Code gets the status code for the enable not found response +func (o *EnableNotFound) Code() int { + return 404 +} + func (o *EnableNotFound) Error() string { return fmt.Sprintf("[POST /enable][%d] enableNotFound ", 404) } @@ -255,6 +270,11 @@ func (o *EnableInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the enable internal server error response +func (o *EnableInternalServerError) Code() int { + return 500 +} + func (o *EnableInternalServerError) Error() string { return fmt.Sprintf("[POST /enable][%d] enableInternalServerError ", 500) } diff --git a/rest_client_zrok/metadata/configuration_responses.go b/rest_client_zrok/metadata/configuration_responses.go index 22e28b701..792cd0038 100644 --- a/rest_client_zrok/metadata/configuration_responses.go +++ b/rest_client_zrok/metadata/configuration_responses.go @@ -30,7 +30,7 @@ func (o *ConfigurationReader) ReadResponse(response runtime.ClientResponse, cons } return result, nil default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[GET /configuration] configuration", response, response.Code()) } } @@ -73,6 +73,11 @@ func (o *ConfigurationOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the configuration o k response +func (o *ConfigurationOK) Code() int { + return 200 +} + func (o *ConfigurationOK) Error() string { return fmt.Sprintf("[GET /configuration][%d] configurationOK %+v", 200, o.Payload) } diff --git a/rest_client_zrok/metadata/get_account_detail_responses.go b/rest_client_zrok/metadata/get_account_detail_responses.go index 2d51df0da..119c33357 100644 --- a/rest_client_zrok/metadata/get_account_detail_responses.go +++ b/rest_client_zrok/metadata/get_account_detail_responses.go @@ -36,7 +36,7 @@ func (o *GetAccountDetailReader) ReadResponse(response runtime.ClientResponse, c } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[GET /detail/account] getAccountDetail", response, response.Code()) } } @@ -79,6 +79,11 @@ func (o *GetAccountDetailOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the get account detail o k response +func (o *GetAccountDetailOK) Code() int { + return 200 +} + func (o *GetAccountDetailOK) Error() string { return fmt.Sprintf("[GET /detail/account][%d] getAccountDetailOK %+v", 200, o.Payload) } @@ -139,6 +144,11 @@ func (o *GetAccountDetailInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the get account detail internal server error response +func (o *GetAccountDetailInternalServerError) Code() int { + return 500 +} + func (o *GetAccountDetailInternalServerError) Error() string { return fmt.Sprintf("[GET /detail/account][%d] getAccountDetailInternalServerError ", 500) } diff --git a/rest_client_zrok/metadata/get_account_metrics_responses.go b/rest_client_zrok/metadata/get_account_metrics_responses.go index 5613b3a59..6cc347461 100644 --- a/rest_client_zrok/metadata/get_account_metrics_responses.go +++ b/rest_client_zrok/metadata/get_account_metrics_responses.go @@ -42,7 +42,7 @@ func (o *GetAccountMetricsReader) ReadResponse(response runtime.ClientResponse, } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[GET /metrics/account] getAccountMetrics", response, response.Code()) } } @@ -85,6 +85,11 @@ func (o *GetAccountMetricsOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the get account metrics o k response +func (o *GetAccountMetricsOK) Code() int { + return 200 +} + func (o *GetAccountMetricsOK) Error() string { return fmt.Sprintf("[GET /metrics/account][%d] getAccountMetricsOK %+v", 200, o.Payload) } @@ -147,6 +152,11 @@ func (o *GetAccountMetricsBadRequest) IsCode(code int) bool { return code == 400 } +// Code gets the status code for the get account metrics bad request response +func (o *GetAccountMetricsBadRequest) Code() int { + return 400 +} + func (o *GetAccountMetricsBadRequest) Error() string { return fmt.Sprintf("[GET /metrics/account][%d] getAccountMetricsBadRequest ", 400) } @@ -198,6 +208,11 @@ func (o *GetAccountMetricsInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the get account metrics internal server error response +func (o *GetAccountMetricsInternalServerError) Code() int { + return 500 +} + func (o *GetAccountMetricsInternalServerError) Error() string { return fmt.Sprintf("[GET /metrics/account][%d] getAccountMetricsInternalServerError ", 500) } diff --git a/rest_client_zrok/metadata/get_environment_detail_responses.go b/rest_client_zrok/metadata/get_environment_detail_responses.go index 35d86c4c3..7247746cb 100644 --- a/rest_client_zrok/metadata/get_environment_detail_responses.go +++ b/rest_client_zrok/metadata/get_environment_detail_responses.go @@ -48,7 +48,7 @@ func (o *GetEnvironmentDetailReader) ReadResponse(response runtime.ClientRespons } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[GET /detail/environment/{envZId}] getEnvironmentDetail", response, response.Code()) } } @@ -91,6 +91,11 @@ func (o *GetEnvironmentDetailOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the get environment detail o k response +func (o *GetEnvironmentDetailOK) Code() int { + return 200 +} + func (o *GetEnvironmentDetailOK) Error() string { return fmt.Sprintf("[GET /detail/environment/{envZId}][%d] getEnvironmentDetailOK %+v", 200, o.Payload) } @@ -153,6 +158,11 @@ func (o *GetEnvironmentDetailUnauthorized) IsCode(code int) bool { return code == 401 } +// Code gets the status code for the get environment detail unauthorized response +func (o *GetEnvironmentDetailUnauthorized) Code() int { + return 401 +} + func (o *GetEnvironmentDetailUnauthorized) Error() string { return fmt.Sprintf("[GET /detail/environment/{envZId}][%d] getEnvironmentDetailUnauthorized ", 401) } @@ -204,6 +214,11 @@ func (o *GetEnvironmentDetailNotFound) IsCode(code int) bool { return code == 404 } +// Code gets the status code for the get environment detail not found response +func (o *GetEnvironmentDetailNotFound) Code() int { + return 404 +} + func (o *GetEnvironmentDetailNotFound) Error() string { return fmt.Sprintf("[GET /detail/environment/{envZId}][%d] getEnvironmentDetailNotFound ", 404) } @@ -255,6 +270,11 @@ func (o *GetEnvironmentDetailInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the get environment detail internal server error response +func (o *GetEnvironmentDetailInternalServerError) Code() int { + return 500 +} + func (o *GetEnvironmentDetailInternalServerError) Error() string { return fmt.Sprintf("[GET /detail/environment/{envZId}][%d] getEnvironmentDetailInternalServerError ", 500) } diff --git a/rest_client_zrok/metadata/get_environment_metrics_responses.go b/rest_client_zrok/metadata/get_environment_metrics_responses.go index e0fb3eaca..0e3317256 100644 --- a/rest_client_zrok/metadata/get_environment_metrics_responses.go +++ b/rest_client_zrok/metadata/get_environment_metrics_responses.go @@ -48,7 +48,7 @@ func (o *GetEnvironmentMetricsReader) ReadResponse(response runtime.ClientRespon } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[GET /metrics/environment/{envId}] getEnvironmentMetrics", response, response.Code()) } } @@ -91,6 +91,11 @@ func (o *GetEnvironmentMetricsOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the get environment metrics o k response +func (o *GetEnvironmentMetricsOK) Code() int { + return 200 +} + func (o *GetEnvironmentMetricsOK) Error() string { return fmt.Sprintf("[GET /metrics/environment/{envId}][%d] getEnvironmentMetricsOK %+v", 200, o.Payload) } @@ -153,6 +158,11 @@ func (o *GetEnvironmentMetricsBadRequest) IsCode(code int) bool { return code == 400 } +// Code gets the status code for the get environment metrics bad request response +func (o *GetEnvironmentMetricsBadRequest) Code() int { + return 400 +} + func (o *GetEnvironmentMetricsBadRequest) Error() string { return fmt.Sprintf("[GET /metrics/environment/{envId}][%d] getEnvironmentMetricsBadRequest ", 400) } @@ -204,6 +214,11 @@ func (o *GetEnvironmentMetricsUnauthorized) IsCode(code int) bool { return code == 401 } +// Code gets the status code for the get environment metrics unauthorized response +func (o *GetEnvironmentMetricsUnauthorized) Code() int { + return 401 +} + func (o *GetEnvironmentMetricsUnauthorized) Error() string { return fmt.Sprintf("[GET /metrics/environment/{envId}][%d] getEnvironmentMetricsUnauthorized ", 401) } @@ -255,6 +270,11 @@ func (o *GetEnvironmentMetricsInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the get environment metrics internal server error response +func (o *GetEnvironmentMetricsInternalServerError) Code() int { + return 500 +} + func (o *GetEnvironmentMetricsInternalServerError) Error() string { return fmt.Sprintf("[GET /metrics/environment/{envId}][%d] getEnvironmentMetricsInternalServerError ", 500) } diff --git a/rest_client_zrok/metadata/get_frontend_detail_responses.go b/rest_client_zrok/metadata/get_frontend_detail_responses.go index 90058d0bb..140204766 100644 --- a/rest_client_zrok/metadata/get_frontend_detail_responses.go +++ b/rest_client_zrok/metadata/get_frontend_detail_responses.go @@ -48,7 +48,7 @@ func (o *GetFrontendDetailReader) ReadResponse(response runtime.ClientResponse, } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[GET /detail/frontend/{feId}] getFrontendDetail", response, response.Code()) } } @@ -91,6 +91,11 @@ func (o *GetFrontendDetailOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the get frontend detail o k response +func (o *GetFrontendDetailOK) Code() int { + return 200 +} + func (o *GetFrontendDetailOK) Error() string { return fmt.Sprintf("[GET /detail/frontend/{feId}][%d] getFrontendDetailOK %+v", 200, o.Payload) } @@ -153,6 +158,11 @@ func (o *GetFrontendDetailUnauthorized) IsCode(code int) bool { return code == 401 } +// Code gets the status code for the get frontend detail unauthorized response +func (o *GetFrontendDetailUnauthorized) Code() int { + return 401 +} + func (o *GetFrontendDetailUnauthorized) Error() string { return fmt.Sprintf("[GET /detail/frontend/{feId}][%d] getFrontendDetailUnauthorized ", 401) } @@ -204,6 +214,11 @@ func (o *GetFrontendDetailNotFound) IsCode(code int) bool { return code == 404 } +// Code gets the status code for the get frontend detail not found response +func (o *GetFrontendDetailNotFound) Code() int { + return 404 +} + func (o *GetFrontendDetailNotFound) Error() string { return fmt.Sprintf("[GET /detail/frontend/{feId}][%d] getFrontendDetailNotFound ", 404) } @@ -255,6 +270,11 @@ func (o *GetFrontendDetailInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the get frontend detail internal server error response +func (o *GetFrontendDetailInternalServerError) Code() int { + return 500 +} + func (o *GetFrontendDetailInternalServerError) Error() string { return fmt.Sprintf("[GET /detail/frontend/{feId}][%d] getFrontendDetailInternalServerError ", 500) } diff --git a/rest_client_zrok/metadata/get_share_detail_responses.go b/rest_client_zrok/metadata/get_share_detail_responses.go index bc4407b0c..420efde5f 100644 --- a/rest_client_zrok/metadata/get_share_detail_responses.go +++ b/rest_client_zrok/metadata/get_share_detail_responses.go @@ -48,7 +48,7 @@ func (o *GetShareDetailReader) ReadResponse(response runtime.ClientResponse, con } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[GET /detail/share/{shrToken}] getShareDetail", response, response.Code()) } } @@ -91,6 +91,11 @@ func (o *GetShareDetailOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the get share detail o k response +func (o *GetShareDetailOK) Code() int { + return 200 +} + func (o *GetShareDetailOK) Error() string { return fmt.Sprintf("[GET /detail/share/{shrToken}][%d] getShareDetailOK %+v", 200, o.Payload) } @@ -153,6 +158,11 @@ func (o *GetShareDetailUnauthorized) IsCode(code int) bool { return code == 401 } +// Code gets the status code for the get share detail unauthorized response +func (o *GetShareDetailUnauthorized) Code() int { + return 401 +} + func (o *GetShareDetailUnauthorized) Error() string { return fmt.Sprintf("[GET /detail/share/{shrToken}][%d] getShareDetailUnauthorized ", 401) } @@ -204,6 +214,11 @@ func (o *GetShareDetailNotFound) IsCode(code int) bool { return code == 404 } +// Code gets the status code for the get share detail not found response +func (o *GetShareDetailNotFound) Code() int { + return 404 +} + func (o *GetShareDetailNotFound) Error() string { return fmt.Sprintf("[GET /detail/share/{shrToken}][%d] getShareDetailNotFound ", 404) } @@ -255,6 +270,11 @@ func (o *GetShareDetailInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the get share detail internal server error response +func (o *GetShareDetailInternalServerError) Code() int { + return 500 +} + func (o *GetShareDetailInternalServerError) Error() string { return fmt.Sprintf("[GET /detail/share/{shrToken}][%d] getShareDetailInternalServerError ", 500) } diff --git a/rest_client_zrok/metadata/get_share_metrics_responses.go b/rest_client_zrok/metadata/get_share_metrics_responses.go index d6d0500d8..1a189a63c 100644 --- a/rest_client_zrok/metadata/get_share_metrics_responses.go +++ b/rest_client_zrok/metadata/get_share_metrics_responses.go @@ -48,7 +48,7 @@ func (o *GetShareMetricsReader) ReadResponse(response runtime.ClientResponse, co } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[GET /metrics/share/{shrToken}] getShareMetrics", response, response.Code()) } } @@ -91,6 +91,11 @@ func (o *GetShareMetricsOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the get share metrics o k response +func (o *GetShareMetricsOK) Code() int { + return 200 +} + func (o *GetShareMetricsOK) Error() string { return fmt.Sprintf("[GET /metrics/share/{shrToken}][%d] getShareMetricsOK %+v", 200, o.Payload) } @@ -153,6 +158,11 @@ func (o *GetShareMetricsBadRequest) IsCode(code int) bool { return code == 400 } +// Code gets the status code for the get share metrics bad request response +func (o *GetShareMetricsBadRequest) Code() int { + return 400 +} + func (o *GetShareMetricsBadRequest) Error() string { return fmt.Sprintf("[GET /metrics/share/{shrToken}][%d] getShareMetricsBadRequest ", 400) } @@ -204,6 +214,11 @@ func (o *GetShareMetricsUnauthorized) IsCode(code int) bool { return code == 401 } +// Code gets the status code for the get share metrics unauthorized response +func (o *GetShareMetricsUnauthorized) Code() int { + return 401 +} + func (o *GetShareMetricsUnauthorized) Error() string { return fmt.Sprintf("[GET /metrics/share/{shrToken}][%d] getShareMetricsUnauthorized ", 401) } @@ -255,6 +270,11 @@ func (o *GetShareMetricsInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the get share metrics internal server error response +func (o *GetShareMetricsInternalServerError) Code() int { + return 500 +} + func (o *GetShareMetricsInternalServerError) Error() string { return fmt.Sprintf("[GET /metrics/share/{shrToken}][%d] getShareMetricsInternalServerError ", 500) } diff --git a/rest_client_zrok/metadata/overview_responses.go b/rest_client_zrok/metadata/overview_responses.go index c16b2a211..9b3b6be4a 100644 --- a/rest_client_zrok/metadata/overview_responses.go +++ b/rest_client_zrok/metadata/overview_responses.go @@ -36,7 +36,7 @@ func (o *OverviewReader) ReadResponse(response runtime.ClientResponse, consumer } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[GET /overview] overview", response, response.Code()) } } @@ -79,6 +79,11 @@ func (o *OverviewOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the overview o k response +func (o *OverviewOK) Code() int { + return 200 +} + func (o *OverviewOK) Error() string { return fmt.Sprintf("[GET /overview][%d] overviewOK %+v", 200, o.Payload) } @@ -142,6 +147,11 @@ func (o *OverviewInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the overview internal server error response +func (o *OverviewInternalServerError) Code() int { + return 500 +} + func (o *OverviewInternalServerError) Error() string { return fmt.Sprintf("[GET /overview][%d] overviewInternalServerError %+v", 500, o.Payload) } diff --git a/rest_client_zrok/metadata/version_responses.go b/rest_client_zrok/metadata/version_responses.go index b1388fedb..97a23fb15 100644 --- a/rest_client_zrok/metadata/version_responses.go +++ b/rest_client_zrok/metadata/version_responses.go @@ -30,7 +30,7 @@ func (o *VersionReader) ReadResponse(response runtime.ClientResponse, consumer r } return result, nil default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[GET /version] version", response, response.Code()) } } @@ -73,6 +73,11 @@ func (o *VersionOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the version o k response +func (o *VersionOK) Code() int { + return 200 +} + func (o *VersionOK) Error() string { return fmt.Sprintf("[GET /version][%d] versionOK %+v", 200, o.Payload) } diff --git a/rest_client_zrok/share/access_responses.go b/rest_client_zrok/share/access_responses.go index 8d1e8e18f..3e5059335 100644 --- a/rest_client_zrok/share/access_responses.go +++ b/rest_client_zrok/share/access_responses.go @@ -48,7 +48,7 @@ func (o *AccessReader) ReadResponse(response runtime.ClientResponse, consumer ru } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[POST /access] access", response, response.Code()) } } @@ -91,6 +91,11 @@ func (o *AccessCreated) IsCode(code int) bool { return code == 201 } +// Code gets the status code for the access created response +func (o *AccessCreated) Code() int { + return 201 +} + func (o *AccessCreated) Error() string { return fmt.Sprintf("[POST /access][%d] accessCreated %+v", 201, o.Payload) } @@ -153,6 +158,11 @@ func (o *AccessUnauthorized) IsCode(code int) bool { return code == 401 } +// Code gets the status code for the access unauthorized response +func (o *AccessUnauthorized) Code() int { + return 401 +} + func (o *AccessUnauthorized) Error() string { return fmt.Sprintf("[POST /access][%d] accessUnauthorized ", 401) } @@ -204,6 +214,11 @@ func (o *AccessNotFound) IsCode(code int) bool { return code == 404 } +// Code gets the status code for the access not found response +func (o *AccessNotFound) Code() int { + return 404 +} + func (o *AccessNotFound) Error() string { return fmt.Sprintf("[POST /access][%d] accessNotFound ", 404) } @@ -255,6 +270,11 @@ func (o *AccessInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the access internal server error response +func (o *AccessInternalServerError) Code() int { + return 500 +} + func (o *AccessInternalServerError) Error() string { return fmt.Sprintf("[POST /access][%d] accessInternalServerError ", 500) } diff --git a/rest_client_zrok/share/share_responses.go b/rest_client_zrok/share/share_responses.go index 8e1c61506..346cbdf35 100644 --- a/rest_client_zrok/share/share_responses.go +++ b/rest_client_zrok/share/share_responses.go @@ -54,7 +54,7 @@ func (o *ShareReader) ReadResponse(response runtime.ClientResponse, consumer run } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[POST /share] share", response, response.Code()) } } @@ -97,6 +97,11 @@ func (o *ShareCreated) IsCode(code int) bool { return code == 201 } +// Code gets the status code for the share created response +func (o *ShareCreated) Code() int { + return 201 +} + func (o *ShareCreated) Error() string { return fmt.Sprintf("[POST /share][%d] shareCreated %+v", 201, o.Payload) } @@ -159,6 +164,11 @@ func (o *ShareUnauthorized) IsCode(code int) bool { return code == 401 } +// Code gets the status code for the share unauthorized response +func (o *ShareUnauthorized) Code() int { + return 401 +} + func (o *ShareUnauthorized) Error() string { return fmt.Sprintf("[POST /share][%d] shareUnauthorized ", 401) } @@ -210,6 +220,11 @@ func (o *ShareNotFound) IsCode(code int) bool { return code == 404 } +// Code gets the status code for the share not found response +func (o *ShareNotFound) Code() int { + return 404 +} + func (o *ShareNotFound) Error() string { return fmt.Sprintf("[POST /share][%d] shareNotFound ", 404) } @@ -261,6 +276,11 @@ func (o *ShareUnprocessableEntity) IsCode(code int) bool { return code == 422 } +// Code gets the status code for the share unprocessable entity response +func (o *ShareUnprocessableEntity) Code() int { + return 422 +} + func (o *ShareUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /share][%d] shareUnprocessableEntity ", 422) } @@ -313,6 +333,11 @@ func (o *ShareInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the share internal server error response +func (o *ShareInternalServerError) Code() int { + return 500 +} + func (o *ShareInternalServerError) Error() string { return fmt.Sprintf("[POST /share][%d] shareInternalServerError %+v", 500, o.Payload) } diff --git a/rest_client_zrok/share/unaccess_responses.go b/rest_client_zrok/share/unaccess_responses.go index 853a66af0..cf0ce393e 100644 --- a/rest_client_zrok/share/unaccess_responses.go +++ b/rest_client_zrok/share/unaccess_responses.go @@ -45,7 +45,7 @@ func (o *UnaccessReader) ReadResponse(response runtime.ClientResponse, consumer } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[DELETE /unaccess] unaccess", response, response.Code()) } } @@ -87,6 +87,11 @@ func (o *UnaccessOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the unaccess o k response +func (o *UnaccessOK) Code() int { + return 200 +} + func (o *UnaccessOK) Error() string { return fmt.Sprintf("[DELETE /unaccess][%d] unaccessOK ", 200) } @@ -138,6 +143,11 @@ func (o *UnaccessUnauthorized) IsCode(code int) bool { return code == 401 } +// Code gets the status code for the unaccess unauthorized response +func (o *UnaccessUnauthorized) Code() int { + return 401 +} + func (o *UnaccessUnauthorized) Error() string { return fmt.Sprintf("[DELETE /unaccess][%d] unaccessUnauthorized ", 401) } @@ -189,6 +199,11 @@ func (o *UnaccessNotFound) IsCode(code int) bool { return code == 404 } +// Code gets the status code for the unaccess not found response +func (o *UnaccessNotFound) Code() int { + return 404 +} + func (o *UnaccessNotFound) Error() string { return fmt.Sprintf("[DELETE /unaccess][%d] unaccessNotFound ", 404) } @@ -240,6 +255,11 @@ func (o *UnaccessInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the unaccess internal server error response +func (o *UnaccessInternalServerError) Code() int { + return 500 +} + func (o *UnaccessInternalServerError) Error() string { return fmt.Sprintf("[DELETE /unaccess][%d] unaccessInternalServerError ", 500) } diff --git a/rest_client_zrok/share/unshare_responses.go b/rest_client_zrok/share/unshare_responses.go index e30e2e50e..71910bf5d 100644 --- a/rest_client_zrok/share/unshare_responses.go +++ b/rest_client_zrok/share/unshare_responses.go @@ -48,7 +48,7 @@ func (o *UnshareReader) ReadResponse(response runtime.ClientResponse, consumer r } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[DELETE /unshare] unshare", response, response.Code()) } } @@ -90,6 +90,11 @@ func (o *UnshareOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the unshare o k response +func (o *UnshareOK) Code() int { + return 200 +} + func (o *UnshareOK) Error() string { return fmt.Sprintf("[DELETE /unshare][%d] unshareOK ", 200) } @@ -141,6 +146,11 @@ func (o *UnshareUnauthorized) IsCode(code int) bool { return code == 401 } +// Code gets the status code for the unshare unauthorized response +func (o *UnshareUnauthorized) Code() int { + return 401 +} + func (o *UnshareUnauthorized) Error() string { return fmt.Sprintf("[DELETE /unshare][%d] unshareUnauthorized ", 401) } @@ -192,6 +202,11 @@ func (o *UnshareNotFound) IsCode(code int) bool { return code == 404 } +// Code gets the status code for the unshare not found response +func (o *UnshareNotFound) Code() int { + return 404 +} + func (o *UnshareNotFound) Error() string { return fmt.Sprintf("[DELETE /unshare][%d] unshareNotFound ", 404) } @@ -244,6 +259,11 @@ func (o *UnshareInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the unshare internal server error response +func (o *UnshareInternalServerError) Code() int { + return 500 +} + func (o *UnshareInternalServerError) Error() string { return fmt.Sprintf("[DELETE /unshare][%d] unshareInternalServerError %+v", 500, o.Payload) } diff --git a/rest_client_zrok/share/update_share_responses.go b/rest_client_zrok/share/update_share_responses.go index e18e45bdd..96726ef60 100644 --- a/rest_client_zrok/share/update_share_responses.go +++ b/rest_client_zrok/share/update_share_responses.go @@ -45,7 +45,7 @@ func (o *UpdateShareReader) ReadResponse(response runtime.ClientResponse, consum } return nil, result default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + return nil, runtime.NewAPIError("[PATCH /share] updateShare", response, response.Code()) } } @@ -87,6 +87,11 @@ func (o *UpdateShareOK) IsCode(code int) bool { return code == 200 } +// Code gets the status code for the update share o k response +func (o *UpdateShareOK) Code() int { + return 200 +} + func (o *UpdateShareOK) Error() string { return fmt.Sprintf("[PATCH /share][%d] updateShareOK ", 200) } @@ -138,6 +143,11 @@ func (o *UpdateShareUnauthorized) IsCode(code int) bool { return code == 401 } +// Code gets the status code for the update share unauthorized response +func (o *UpdateShareUnauthorized) Code() int { + return 401 +} + func (o *UpdateShareUnauthorized) Error() string { return fmt.Sprintf("[PATCH /share][%d] updateShareUnauthorized ", 401) } @@ -189,6 +199,11 @@ func (o *UpdateShareNotFound) IsCode(code int) bool { return code == 404 } +// Code gets the status code for the update share not found response +func (o *UpdateShareNotFound) Code() int { + return 404 +} + func (o *UpdateShareNotFound) Error() string { return fmt.Sprintf("[PATCH /share][%d] updateShareNotFound ", 404) } @@ -240,6 +255,11 @@ func (o *UpdateShareInternalServerError) IsCode(code int) bool { return code == 500 } +// Code gets the status code for the update share internal server error response +func (o *UpdateShareInternalServerError) Code() int { + return 500 +} + func (o *UpdateShareInternalServerError) Error() string { return fmt.Sprintf("[PATCH /share][%d] updateShareInternalServerError ", 500) } diff --git a/rest_model_zrok/configuration.go b/rest_model_zrok/configuration.go index fad8c7386..680a12542 100644 --- a/rest_model_zrok/configuration.go +++ b/rest_model_zrok/configuration.go @@ -87,6 +87,11 @@ func (m *Configuration) ContextValidate(ctx context.Context, formats strfmt.Regi func (m *Configuration) contextValidatePasswordRequirements(ctx context.Context, formats strfmt.Registry) error { if m.PasswordRequirements != nil { + + if swag.IsZero(m.PasswordRequirements) { // not required + return nil + } + if err := m.PasswordRequirements.ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("passwordRequirements") diff --git a/rest_model_zrok/environment_and_resources.go b/rest_model_zrok/environment_and_resources.go index 493d28180..b48a9ac25 100644 --- a/rest_model_zrok/environment_and_resources.go +++ b/rest_model_zrok/environment_and_resources.go @@ -128,6 +128,11 @@ func (m *EnvironmentAndResources) ContextValidate(ctx context.Context, formats s func (m *EnvironmentAndResources) contextValidateEnvironment(ctx context.Context, formats strfmt.Registry) error { if m.Environment != nil { + + if swag.IsZero(m.Environment) { // not required + return nil + } + if err := m.Environment.ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("environment") diff --git a/rest_model_zrok/environments.go b/rest_model_zrok/environments.go index f98b0dcf4..3789676a8 100644 --- a/rest_model_zrok/environments.go +++ b/rest_model_zrok/environments.go @@ -54,6 +54,11 @@ func (m Environments) ContextValidate(ctx context.Context, formats strfmt.Regist for i := 0; i < len(m); i++ { if m[i] != nil { + + if swag.IsZero(m[i]) { // not required + return nil + } + if err := m[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName(strconv.Itoa(i)) diff --git a/rest_model_zrok/frontends.go b/rest_model_zrok/frontends.go index 62f23b2a0..0cdd8c52f 100644 --- a/rest_model_zrok/frontends.go +++ b/rest_model_zrok/frontends.go @@ -54,6 +54,11 @@ func (m Frontends) ContextValidate(ctx context.Context, formats strfmt.Registry) for i := 0; i < len(m); i++ { if m[i] != nil { + + if swag.IsZero(m[i]) { // not required + return nil + } + if err := m[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName(strconv.Itoa(i)) diff --git a/rest_model_zrok/metrics.go b/rest_model_zrok/metrics.go index 1aa24172a..7c069ad62 100644 --- a/rest_model_zrok/metrics.go +++ b/rest_model_zrok/metrics.go @@ -91,6 +91,11 @@ func (m *Metrics) contextValidateSamples(ctx context.Context, formats strfmt.Reg for i := 0; i < len(m.Samples); i++ { if m.Samples[i] != nil { + + if swag.IsZero(m.Samples[i]) { // not required + return nil + } + if err := m.Samples[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("samples" + "." + strconv.Itoa(i)) diff --git a/rest_model_zrok/overview.go b/rest_model_zrok/overview.go index fc2dbeb0f..a9fd4f6fc 100644 --- a/rest_model_zrok/overview.go +++ b/rest_model_zrok/overview.go @@ -85,6 +85,11 @@ func (m *Overview) contextValidateEnvironments(ctx context.Context, formats strf for i := 0; i < len(m.Environments); i++ { if m.Environments[i] != nil { + + if swag.IsZero(m.Environments[i]) { // not required + return nil + } + if err := m.Environments[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("environments" + "." + strconv.Itoa(i)) diff --git a/rest_model_zrok/public_frontend_list.go b/rest_model_zrok/public_frontend_list.go index af910b1d3..7f294bc57 100644 --- a/rest_model_zrok/public_frontend_list.go +++ b/rest_model_zrok/public_frontend_list.go @@ -54,6 +54,11 @@ func (m PublicFrontendList) ContextValidate(ctx context.Context, formats strfmt. for i := 0; i < len(m); i++ { if m[i] != nil { + + if swag.IsZero(m[i]) { // not required + return nil + } + if err := m[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName(strconv.Itoa(i)) diff --git a/rest_model_zrok/share_request.go b/rest_model_zrok/share_request.go index 8fddf3675..ae118a967 100644 --- a/rest_model_zrok/share_request.go +++ b/rest_model_zrok/share_request.go @@ -56,6 +56,9 @@ type ShareRequest struct { // share mode // Enum: [public private] ShareMode string `json:"shareMode,omitempty"` + + // unique name + UniqueName string `json:"uniqueName,omitempty"` } // Validate validates this share request @@ -267,6 +270,11 @@ func (m *ShareRequest) contextValidateAuthUsers(ctx context.Context, formats str for i := 0; i < len(m.AuthUsers); i++ { if m.AuthUsers[i] != nil { + + if swag.IsZero(m.AuthUsers[i]) { // not required + return nil + } + if err := m.AuthUsers[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("authUsers" + "." + strconv.Itoa(i)) diff --git a/rest_model_zrok/shares.go b/rest_model_zrok/shares.go index 42b60acd6..527919f9e 100644 --- a/rest_model_zrok/shares.go +++ b/rest_model_zrok/shares.go @@ -54,6 +54,11 @@ func (m Shares) ContextValidate(ctx context.Context, formats strfmt.Registry) er for i := 0; i < len(m); i++ { if m[i] != nil { + + if swag.IsZero(m[i]) { // not required + return nil + } + if err := m[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName(strconv.Itoa(i)) diff --git a/rest_model_zrok/spark_data.go b/rest_model_zrok/spark_data.go index 1d0f66351..8faf73bde 100644 --- a/rest_model_zrok/spark_data.go +++ b/rest_model_zrok/spark_data.go @@ -54,6 +54,11 @@ func (m SparkData) ContextValidate(ctx context.Context, formats strfmt.Registry) for i := 0; i < len(m); i++ { if m[i] != nil { + + if swag.IsZero(m[i]) { // not required + return nil + } + if err := m[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName(strconv.Itoa(i)) diff --git a/rest_server_zrok/embedded_spec.go b/rest_server_zrok/embedded_spec.go index 67e518997..72cc40ed0 100644 --- a/rest_server_zrok/embedded_spec.go +++ b/rest_server_zrok/embedded_spec.go @@ -1513,6 +1513,9 @@ func init() { "public", "private" ] + }, + "uniqueName": { + "type": "string" } } }, @@ -3130,6 +3133,9 @@ func init() { "public", "private" ] + }, + "uniqueName": { + "type": "string" } } }, diff --git a/rest_server_zrok/operations/zrok_api.go b/rest_server_zrok/operations/zrok_api.go index 158e03c38..9b508804a 100644 --- a/rest_server_zrok/operations/zrok_api.go +++ b/rest_server_zrok/operations/zrok_api.go @@ -668,6 +668,6 @@ func (o *ZrokAPI) AddMiddlewareFor(method, path string, builder middleware.Build } o.Init() if h, ok := o.handlers[um][path]; ok { - o.handlers[method][path] = builder(h) + o.handlers[um][path] = builder(h) } } diff --git a/sdk/golang/sdk/model.go b/sdk/golang/sdk/model.go index 4eed621b6..4289b84e8 100644 --- a/sdk/golang/sdk/model.go +++ b/sdk/golang/sdk/model.go @@ -22,6 +22,7 @@ const ( type ShareRequest struct { Reserved bool + UniqueName string BackendMode BackendMode ShareMode ShareMode Target string diff --git a/sdk/golang/sdk/share.go b/sdk/golang/sdk/share.go index 45feb57fd..49fc56065 100644 --- a/sdk/golang/sdk/share.go +++ b/sdk/golang/sdk/share.go @@ -26,6 +26,9 @@ func CreateShare(root env_core.Root, request *ShareRequest) (*Share, error) { return nil, errors.Errorf("unknown share mode '%v'", request.ShareMode) } out.Body.Reserved = request.Reserved + if request.Reserved { + out.Body.UniqueName = request.UniqueName + } if len(request.BasicAuth) > 0 { out.Body.AuthScheme = string(Basic) diff --git a/sdk/python/sdk/zrok/.swagger-codegen/VERSION b/sdk/python/sdk/zrok/.swagger-codegen/VERSION index 48e698941..b262b4de7 100644 --- a/sdk/python/sdk/zrok/.swagger-codegen/VERSION +++ b/sdk/python/sdk/zrok/.swagger-codegen/VERSION @@ -1 +1 @@ -3.0.50 \ No newline at end of file +3.0.51 \ No newline at end of file diff --git a/sdk/python/sdk/zrok/setup.py b/sdk/python/sdk/zrok/setup.py index e8eb84d57..562368dfd 100644 --- a/sdk/python/sdk/zrok/setup.py +++ b/sdk/python/sdk/zrok/setup.py @@ -2,7 +2,7 @@ import os NAME = "zrok_sdk" -VERSION = "0.0.0.dev" +VERSION = "0.4.0.dev" try: VERSION = os.environ['ZROK_VERSION'] except KeyError: diff --git a/sdk/python/sdk/zrok/zrok/model.py b/sdk/python/sdk/zrok/zrok/model.py index 28efeccaa..a21924df3 100644 --- a/sdk/python/sdk/zrok/zrok/model.py +++ b/sdk/python/sdk/zrok/zrok/model.py @@ -23,6 +23,8 @@ class ShareRequest: OauthProvider: str = "" OauthEmailDomains: list[str] = field(default_factory=list[str]) OauthAuthorizationCheckInterval: str = "" + Reserved: bool = False + UniqueName: str = "" @dataclass class Share: diff --git a/sdk/python/sdk/zrok/zrok/share.py b/sdk/python/sdk/zrok/zrok/share.py index 2bdc07ebd..08fa58144 100644 --- a/sdk/python/sdk/zrok/zrok/share.py +++ b/sdk/python/sdk/zrok/zrok/share.py @@ -14,7 +14,10 @@ def CreateShare(root: Root, request: model.ShareRequest) -> model.Share: out = __newPublicShare(root, request) case _: raise Exception("unknown share mode " + request.ShareMode) - + out.reserved = request.Reserved + if request.Reserved: + out.unique_name = request.UniqueName + if len(request.BasicAuth) > 0: out.auth_scheme = model.AUTH_SCHEME_BASIC for pair in request.BasicAuth: diff --git a/sdk/python/sdk/zrok/zrok_api/models/share_request.py b/sdk/python/sdk/zrok/zrok_api/models/share_request.py index fdbc74770..616164498 100644 --- a/sdk/python/sdk/zrok/zrok_api/models/share_request.py +++ b/sdk/python/sdk/zrok/zrok_api/models/share_request.py @@ -38,7 +38,8 @@ class ShareRequest(object): 'oauth_provider': 'str', 'oauth_email_domains': 'list[str]', 'oauth_authorization_check_interval': 'str', - 'reserved': 'bool' + 'reserved': 'bool', + 'unique_name': 'str' } attribute_map = { @@ -52,10 +53,11 @@ class ShareRequest(object): 'oauth_provider': 'oauthProvider', 'oauth_email_domains': 'oauthEmailDomains', 'oauth_authorization_check_interval': 'oauthAuthorizationCheckInterval', - 'reserved': 'reserved' + 'reserved': 'reserved', + 'unique_name': 'uniqueName' } - def __init__(self, env_zid=None, share_mode=None, frontend_selection=None, backend_mode=None, backend_proxy_endpoint=None, auth_scheme=None, auth_users=None, oauth_provider=None, oauth_email_domains=None, oauth_authorization_check_interval=None, reserved=None): # noqa: E501 + def __init__(self, env_zid=None, share_mode=None, frontend_selection=None, backend_mode=None, backend_proxy_endpoint=None, auth_scheme=None, auth_users=None, oauth_provider=None, oauth_email_domains=None, oauth_authorization_check_interval=None, reserved=None, unique_name=None): # noqa: E501 """ShareRequest - a model defined in Swagger""" # noqa: E501 self._env_zid = None self._share_mode = None @@ -68,6 +70,7 @@ def __init__(self, env_zid=None, share_mode=None, frontend_selection=None, backe self._oauth_email_domains = None self._oauth_authorization_check_interval = None self._reserved = None + self._unique_name = None self.discriminator = None if env_zid is not None: self.env_zid = env_zid @@ -91,6 +94,8 @@ def __init__(self, env_zid=None, share_mode=None, frontend_selection=None, backe self.oauth_authorization_check_interval = oauth_authorization_check_interval if reserved is not None: self.reserved = reserved + if unique_name is not None: + self.unique_name = unique_name @property def env_zid(self): @@ -179,7 +184,7 @@ def backend_mode(self, backend_mode): :param backend_mode: The backend_mode of this ShareRequest. # noqa: E501 :type: str """ - allowed_values = ["proxy", "web", "tcpTunnel", "udpTunnel", "caddy"] # noqa: E501 + allowed_values = ["proxy", "web", "tcpTunnel", "udpTunnel", "caddy", "drive"] # noqa: E501 if backend_mode not in allowed_values: raise ValueError( "Invalid value for `backend_mode` ({0}), must be one of {1}" # noqa: E501 @@ -341,6 +346,27 @@ def reserved(self, reserved): self._reserved = reserved + @property + def unique_name(self): + """Gets the unique_name of this ShareRequest. # noqa: E501 + + + :return: The unique_name of this ShareRequest. # noqa: E501 + :rtype: str + """ + return self._unique_name + + @unique_name.setter + def unique_name(self, unique_name): + """Sets the unique_name of this ShareRequest. + + + :param unique_name: The unique_name of this ShareRequest. # noqa: E501 + :type: str + """ + + self._unique_name = unique_name + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/specs/zrok.yml b/specs/zrok.yml index 1f5ebeb8c..777b8e3cf 100644 --- a/specs/zrok.yml +++ b/specs/zrok.yml @@ -991,6 +991,8 @@ definitions: type: string reserved: type: boolean + uniqueName: + type: string shareResponse: type: object diff --git a/ui/src/api/types.js b/ui/src/api/types.js index 5f06119b2..bef4685ad 100644 --- a/ui/src/api/types.js +++ b/ui/src/api/types.js @@ -257,6 +257,7 @@ * @property {string[]} oauthEmailDomains * @property {string} oauthAuthorizationCheckInterval * @property {boolean} reserved + * @property {string} uniqueName */ /** diff --git a/util/uniqueName.go b/util/uniqueName.go new file mode 100644 index 000000000..419f8f1d2 --- /dev/null +++ b/util/uniqueName.go @@ -0,0 +1,18 @@ +package util + +import ( + goaway "github.com/TwiN/go-away" + "regexp" +) + +// IsValidUniqueName ensures that the string represents a valid unique name. Lowercase alphanumeric only. 4-32 characters. +func IsValidUniqueName(uniqueName string) bool { + match, err := regexp.Match("^[a-z0-9]{4,32}$", []byte(uniqueName)) + if err != nil { + return false + } + if match && goaway.IsProfane(uniqueName) { + return false + } + return match +}