From 84ac03c0489e53a2782e57fc220bd927195eed91 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Tue, 26 Jul 2022 15:16:02 -0400 Subject: [PATCH] api package naming cleanup (less conflicts with existing ziti infrastructure) --- bin/generate_rest.sh | 4 +- cmd/zrok/api.go | 2 +- cmd/zrok/client.go | 6 +- cmd/zrok/create.go | 6 +- cmd/zrok/enable.go | 6 +- controller/account.go | 6 +- controller/controller.go | 16 +-- controller/enable.go | 6 +- .../identity/create_account_parameters.go | 8 +- .../identity/create_account_responses.go | 8 +- .../identity/enable_parameters.go | 8 +- .../identity/enable_responses.go | 8 +- .../identity/identity_client.go | 0 .../metadata/metadata_client.go | 0 .../metadata/version_parameters.go | 0 .../metadata/version_responses.go | 8 +- .../zrok_client.go | 6 +- rest_model/base_entity.go | 110 --------------- .../account_request.go | 2 +- .../account_response.go | 2 +- .../enable_request.go | 2 +- .../enable_response.go | 2 +- {rest_model => rest_model_zrok}/version.go | 2 +- .../configure_zrok.go | 6 +- {rest_zrok_server => rest_server_zrok}/doc.go | 4 +- .../embedded_spec.go | 2 +- .../operations/identity/create_account.go | 0 .../identity/create_account_parameters.go | 6 +- .../identity/create_account_responses.go | 8 +- .../identity/create_account_urlbuilder.go | 0 .../operations/identity/enable.go | 0 .../operations/identity/enable_parameters.go | 6 +- .../operations/identity/enable_responses.go | 8 +- .../operations/identity/enable_urlbuilder.go | 0 .../operations/metadata/version.go | 0 .../operations/metadata/version_parameters.go | 0 .../operations/metadata/version_responses.go | 8 +- .../operations/metadata/version_urlbuilder.go | 0 .../operations/zrok_api.go | 4 +- .../server.go | 4 +- rest_zrok_client/metadata/get_parameters.go | 126 ------------------ rest_zrok_client/metadata/get_responses.go | 67 ---------- rest_zrok_server/operations/metadata/get.go | 56 -------- .../operations/metadata/get_parameters.go | 46 ------- .../operations/metadata/get_responses.go | 58 -------- .../operations/metadata/get_urlbuilder.go | 84 ------------ 46 files changed, 82 insertions(+), 629 deletions(-) rename {rest_zrok_client => rest_client_zrok}/identity/create_account_parameters.go (93%) rename {rest_zrok_client => rest_client_zrok}/identity/create_account_responses.go (93%) rename {rest_zrok_client => rest_client_zrok}/identity/enable_parameters.go (93%) rename {rest_zrok_client => rest_client_zrok}/identity/enable_responses.go (93%) rename {rest_zrok_client => rest_client_zrok}/identity/identity_client.go (100%) rename {rest_zrok_client => rest_client_zrok}/metadata/metadata_client.go (100%) rename {rest_zrok_client => rest_client_zrok}/metadata/version_parameters.go (100%) rename {rest_zrok_client => rest_client_zrok}/metadata/version_responses.go (89%) rename {rest_zrok_client => rest_client_zrok}/zrok_client.go (95%) delete mode 100644 rest_model/base_entity.go rename {rest_model => rest_model_zrok}/account_request.go (98%) rename {rest_model => rest_model_zrok}/account_response.go (97%) rename {rest_model => rest_model_zrok}/enable_request.go (97%) rename {rest_model => rest_model_zrok}/enable_response.go (97%) rename {rest_model => rest_model_zrok}/version.go (97%) rename {rest_zrok_server => rest_server_zrok}/configure_zrok.go (89%) rename {rest_zrok_server => rest_server_zrok}/doc.go (82%) rename {rest_zrok_server => rest_server_zrok}/embedded_spec.go (99%) rename {rest_zrok_server => rest_server_zrok}/operations/identity/create_account.go (100%) rename {rest_zrok_server => rest_server_zrok}/operations/identity/create_account_parameters.go (93%) rename {rest_zrok_server => rest_server_zrok}/operations/identity/create_account_responses.go (89%) rename {rest_zrok_server => rest_server_zrok}/operations/identity/create_account_urlbuilder.go (100%) rename {rest_zrok_server => rest_server_zrok}/operations/identity/enable.go (100%) rename {rest_zrok_server => rest_server_zrok}/operations/identity/enable_parameters.go (93%) rename {rest_zrok_server => rest_server_zrok}/operations/identity/enable_responses.go (89%) rename {rest_zrok_server => rest_server_zrok}/operations/identity/enable_urlbuilder.go (100%) rename {rest_zrok_server => rest_server_zrok}/operations/metadata/version.go (100%) rename {rest_zrok_server => rest_server_zrok}/operations/metadata/version_parameters.go (100%) rename {rest_zrok_server => rest_server_zrok}/operations/metadata/version_responses.go (80%) rename {rest_zrok_server => rest_server_zrok}/operations/metadata/version_urlbuilder.go (100%) rename {rest_zrok_server => rest_server_zrok}/operations/zrok_api.go (98%) rename {rest_zrok_server => rest_server_zrok}/server.go (99%) delete mode 100644 rest_zrok_client/metadata/get_parameters.go delete mode 100644 rest_zrok_client/metadata/get_responses.go delete mode 100644 rest_zrok_server/operations/metadata/get.go delete mode 100644 rest_zrok_server/operations/metadata/get_parameters.go delete mode 100644 rest_zrok_server/operations/metadata/get_responses.go delete mode 100644 rest_zrok_server/operations/metadata/get_urlbuilder.go diff --git a/bin/generate_rest.sh b/bin/generate_rest.sh index 42db7975..649948d9 100755 --- a/bin/generate_rest.sh +++ b/bin/generate_rest.sh @@ -15,7 +15,7 @@ zrokDir=$(realpath "$scriptDir/..") zrokSpec=$(realpath "$zrokDir/specs/zrok.yml") echo "...generating zrok server" -swagger generate server -f "$zrokSpec" -s rest_zrok_server -t "$zrokDir" -m "rest_model" --exclude-main +swagger generate server -f "$zrokSpec" -s rest_server_zrok -t "$zrokDir" -m "rest_model_zrok" --exclude-main echo "...generating zrok client" -swagger generate client -f "$zrokSpec" -c rest_zrok_client -t "$zrokDir" -m "rest_model" \ No newline at end of file +swagger generate client -f "$zrokSpec" -c rest_client_zrok -t "$zrokDir" -m "rest_model_zrok" \ No newline at end of file diff --git a/cmd/zrok/api.go b/cmd/zrok/api.go index fd13818a..4da06add 100644 --- a/cmd/zrok/api.go +++ b/cmd/zrok/api.go @@ -1,7 +1,7 @@ package main import ( - "github.com/openziti-test-kitchen/zrok/rest_zrok_client/metadata" + "github.com/openziti-test-kitchen/zrok/rest_client_zrok/metadata" "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) diff --git a/cmd/zrok/client.go b/cmd/zrok/client.go index fc31a7ea..cd7be7f1 100644 --- a/cmd/zrok/client.go +++ b/cmd/zrok/client.go @@ -4,12 +4,12 @@ import ( "github.com/go-openapi/runtime" httptransport "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" - "github.com/openziti-test-kitchen/zrok/rest_zrok_client" + "github.com/openziti-test-kitchen/zrok/rest_client_zrok" ) -func newZrokClient() *rest_zrok_client.Zrok { +func newZrokClient() *rest_client_zrok.Zrok { transport := httptransport.New(endpoint, "", nil) transport.Producers["application/zrok.v1+json"] = runtime.JSONProducer() transport.Consumers["application/zrok.v1+json"] = runtime.JSONConsumer() - return rest_zrok_client.New(transport, strfmt.Default) + return rest_client_zrok.New(transport, strfmt.Default) } diff --git a/cmd/zrok/create.go b/cmd/zrok/create.go index d5aa57f4..ef050168 100644 --- a/cmd/zrok/create.go +++ b/cmd/zrok/create.go @@ -1,8 +1,8 @@ package main import ( - "github.com/openziti-test-kitchen/zrok/rest_model" - "github.com/openziti-test-kitchen/zrok/rest_zrok_client/identity" + "github.com/openziti-test-kitchen/zrok/rest_client_zrok/identity" + "github.com/openziti-test-kitchen/zrok/rest_model_zrok" "github.com/openziti/foundation/v2/term" "github.com/sirupsen/logrus" "github.com/spf13/cobra" @@ -40,7 +40,7 @@ var createAccountCmd = &cobra.Command{ zrok := newZrokClient() req := identity.NewCreateAccountParams() - req.Body = &rest_model.AccountRequest{ + req.Body = &rest_model_zrok.AccountRequest{ Username: username, Password: password, } diff --git a/cmd/zrok/enable.go b/cmd/zrok/enable.go index 2bf1392a..a27e7997 100644 --- a/cmd/zrok/enable.go +++ b/cmd/zrok/enable.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/openziti-test-kitchen/zrok/rest_model" - "github.com/openziti-test-kitchen/zrok/rest_zrok_client/identity" + "github.com/openziti-test-kitchen/zrok/rest_client_zrok/identity" + "github.com/openziti-test-kitchen/zrok/rest_model_zrok" "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/spf13/cobra" @@ -27,7 +27,7 @@ func enable(_ *cobra.Command, args []string) { zrok := newZrokClient() req := identity.NewEnableParams() - req.Body = &rest_model.EnableRequest{ + req.Body = &rest_model_zrok.EnableRequest{ Token: args[0], } resp, err := zrok.Identity.Enable(req) diff --git a/controller/account.go b/controller/account.go index fd8d9cbc..34dbf919 100644 --- a/controller/account.go +++ b/controller/account.go @@ -5,8 +5,8 @@ import ( "encoding/hex" "github.com/go-openapi/runtime/middleware" "github.com/openziti-test-kitchen/zrok/controller/store" - "github.com/openziti-test-kitchen/zrok/rest_model" - "github.com/openziti-test-kitchen/zrok/rest_zrok_server/operations/identity" + "github.com/openziti-test-kitchen/zrok/rest_model_zrok" + "github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/identity" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -44,7 +44,7 @@ func createAccountHandler(params identity.CreateAccountParams) middleware.Respon } logrus.Infof("account created with id = '%v'", id) - return identity.NewCreateAccountCreated().WithPayload(&rest_model.AccountResponse{ + return identity.NewCreateAccountCreated().WithPayload(&rest_model_zrok.AccountResponse{ Token: token, }) } diff --git a/controller/controller.go b/controller/controller.go index bc4d30f1..e9fb28ae 100644 --- a/controller/controller.go +++ b/controller/controller.go @@ -4,11 +4,11 @@ import ( "github.com/go-openapi/loads" "github.com/go-openapi/runtime/middleware" "github.com/openziti-test-kitchen/zrok/controller/store" - "github.com/openziti-test-kitchen/zrok/rest_model" - "github.com/openziti-test-kitchen/zrok/rest_zrok_server" - "github.com/openziti-test-kitchen/zrok/rest_zrok_server/operations" - "github.com/openziti-test-kitchen/zrok/rest_zrok_server/operations/identity" - "github.com/openziti-test-kitchen/zrok/rest_zrok_server/operations/metadata" + "github.com/openziti-test-kitchen/zrok/rest_model_zrok" + "github.com/openziti-test-kitchen/zrok/rest_server_zrok" + "github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations" + "github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/identity" + "github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/metadata" "github.com/pkg/errors" ) @@ -21,7 +21,7 @@ func Run(cfg *Config) error { return errors.Wrap(err, "error opening store") } - swaggerSpec, err := loads.Embedded(rest_zrok_server.SwaggerJSON, rest_zrok_server.FlatSwaggerJSON) + swaggerSpec, err := loads.Embedded(rest_server_zrok.SwaggerJSON, rest_server_zrok.FlatSwaggerJSON) if err != nil { return errors.Wrap(err, "error loading embedded swagger spec") } @@ -31,7 +31,7 @@ func Run(cfg *Config) error { api.IdentityCreateAccountHandler = identity.CreateAccountHandlerFunc(createAccountHandler) api.IdentityEnableHandler = identity.EnableHandlerFunc(enableHandler) - server := rest_zrok_server.NewServer(api) + server := rest_server_zrok.NewServer(api) defer func() { _ = server.Shutdown() }() server.Host = cfg.Host server.Port = cfg.Port @@ -43,5 +43,5 @@ func Run(cfg *Config) error { } func versionHandler(_ metadata.VersionParams) middleware.Responder { - return metadata.NewGetOK().WithPayload(&rest_model.Version{Version: "v0.0.0; sk3tch"}) + return metadata.NewVersionOK().WithPayload(&rest_model_zrok.Version{Version: "v0.0.1; sk3tch"}) } diff --git a/controller/enable.go b/controller/enable.go index d5011c5a..e030bf5f 100644 --- a/controller/enable.go +++ b/controller/enable.go @@ -8,8 +8,8 @@ import ( "fmt" "github.com/go-openapi/runtime/middleware" "github.com/openziti-test-kitchen/zrok/controller/store" - "github.com/openziti-test-kitchen/zrok/rest_model" - "github.com/openziti-test-kitchen/zrok/rest_zrok_server/operations/identity" + "github.com/openziti-test-kitchen/zrok/rest_model_zrok" + "github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/identity" "github.com/openziti/edge/rest_management_api_client" identity_edge "github.com/openziti/edge/rest_management_api_client/identity" rest_model_edge "github.com/openziti/edge/rest_model" @@ -61,7 +61,7 @@ func enableHandler(params identity.EnableParams) middleware.Responder { panic(err) } - resp := identity.NewEnableCreated().WithPayload(&rest_model.EnableResponse{ + resp := identity.NewEnableCreated().WithPayload(&rest_model_zrok.EnableResponse{ Identity: ident.Payload.Data.ID, }) diff --git a/rest_zrok_client/identity/create_account_parameters.go b/rest_client_zrok/identity/create_account_parameters.go similarity index 93% rename from rest_zrok_client/identity/create_account_parameters.go rename to rest_client_zrok/identity/create_account_parameters.go index 0d930e84..55751309 100644 --- a/rest_zrok_client/identity/create_account_parameters.go +++ b/rest_client_zrok/identity/create_account_parameters.go @@ -15,7 +15,7 @@ import ( cr "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" - "github.com/openziti-test-kitchen/zrok/rest_model" + "github.com/openziti-test-kitchen/zrok/rest_model_zrok" ) // NewCreateAccountParams creates a new CreateAccountParams object, @@ -62,7 +62,7 @@ func NewCreateAccountParamsWithHTTPClient(client *http.Client) *CreateAccountPar type CreateAccountParams struct { // Body. - Body *rest_model.AccountRequest + Body *rest_model_zrok.AccountRequest timeout time.Duration Context context.Context @@ -118,13 +118,13 @@ func (o *CreateAccountParams) SetHTTPClient(client *http.Client) { } // WithBody adds the body to the create account params -func (o *CreateAccountParams) WithBody(body *rest_model.AccountRequest) *CreateAccountParams { +func (o *CreateAccountParams) WithBody(body *rest_model_zrok.AccountRequest) *CreateAccountParams { o.SetBody(body) return o } // SetBody adds the body to the create account params -func (o *CreateAccountParams) SetBody(body *rest_model.AccountRequest) { +func (o *CreateAccountParams) SetBody(body *rest_model_zrok.AccountRequest) { o.Body = body } diff --git a/rest_zrok_client/identity/create_account_responses.go b/rest_client_zrok/identity/create_account_responses.go similarity index 93% rename from rest_zrok_client/identity/create_account_responses.go rename to rest_client_zrok/identity/create_account_responses.go index 04358202..ac4de571 100644 --- a/rest_zrok_client/identity/create_account_responses.go +++ b/rest_client_zrok/identity/create_account_responses.go @@ -12,7 +12,7 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/strfmt" - "github.com/openziti-test-kitchen/zrok/rest_model" + "github.com/openziti-test-kitchen/zrok/rest_model_zrok" ) // CreateAccountReader is a Reader for the CreateAccount structure. @@ -56,19 +56,19 @@ func NewCreateAccountCreated() *CreateAccountCreated { account created */ type CreateAccountCreated struct { - Payload *rest_model.AccountResponse + Payload *rest_model_zrok.AccountResponse } func (o *CreateAccountCreated) Error() string { return fmt.Sprintf("[POST /account][%d] createAccountCreated %+v", 201, o.Payload) } -func (o *CreateAccountCreated) GetPayload() *rest_model.AccountResponse { +func (o *CreateAccountCreated) GetPayload() *rest_model_zrok.AccountResponse { return o.Payload } func (o *CreateAccountCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(rest_model.AccountResponse) + o.Payload = new(rest_model_zrok.AccountResponse) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { diff --git a/rest_zrok_client/identity/enable_parameters.go b/rest_client_zrok/identity/enable_parameters.go similarity index 93% rename from rest_zrok_client/identity/enable_parameters.go rename to rest_client_zrok/identity/enable_parameters.go index da063b69..a44f9b83 100644 --- a/rest_zrok_client/identity/enable_parameters.go +++ b/rest_client_zrok/identity/enable_parameters.go @@ -15,7 +15,7 @@ import ( cr "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" - "github.com/openziti-test-kitchen/zrok/rest_model" + "github.com/openziti-test-kitchen/zrok/rest_model_zrok" ) // NewEnableParams creates a new EnableParams object, @@ -62,7 +62,7 @@ func NewEnableParamsWithHTTPClient(client *http.Client) *EnableParams { type EnableParams struct { // Body. - Body *rest_model.EnableRequest + Body *rest_model_zrok.EnableRequest timeout time.Duration Context context.Context @@ -118,13 +118,13 @@ func (o *EnableParams) SetHTTPClient(client *http.Client) { } // WithBody adds the body to the enable params -func (o *EnableParams) WithBody(body *rest_model.EnableRequest) *EnableParams { +func (o *EnableParams) WithBody(body *rest_model_zrok.EnableRequest) *EnableParams { o.SetBody(body) return o } // SetBody adds the body to the enable params -func (o *EnableParams) SetBody(body *rest_model.EnableRequest) { +func (o *EnableParams) SetBody(body *rest_model_zrok.EnableRequest) { o.Body = body } diff --git a/rest_zrok_client/identity/enable_responses.go b/rest_client_zrok/identity/enable_responses.go similarity index 93% rename from rest_zrok_client/identity/enable_responses.go rename to rest_client_zrok/identity/enable_responses.go index 6da5f7d9..f9c458d7 100644 --- a/rest_zrok_client/identity/enable_responses.go +++ b/rest_client_zrok/identity/enable_responses.go @@ -12,7 +12,7 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/strfmt" - "github.com/openziti-test-kitchen/zrok/rest_model" + "github.com/openziti-test-kitchen/zrok/rest_model_zrok" ) // EnableReader is a Reader for the Enable structure. @@ -56,19 +56,19 @@ func NewEnableCreated() *EnableCreated { environment enabled */ type EnableCreated struct { - Payload *rest_model.EnableResponse + Payload *rest_model_zrok.EnableResponse } func (o *EnableCreated) Error() string { return fmt.Sprintf("[POST /enable][%d] enableCreated %+v", 201, o.Payload) } -func (o *EnableCreated) GetPayload() *rest_model.EnableResponse { +func (o *EnableCreated) GetPayload() *rest_model_zrok.EnableResponse { return o.Payload } func (o *EnableCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(rest_model.EnableResponse) + o.Payload = new(rest_model_zrok.EnableResponse) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { diff --git a/rest_zrok_client/identity/identity_client.go b/rest_client_zrok/identity/identity_client.go similarity index 100% rename from rest_zrok_client/identity/identity_client.go rename to rest_client_zrok/identity/identity_client.go diff --git a/rest_zrok_client/metadata/metadata_client.go b/rest_client_zrok/metadata/metadata_client.go similarity index 100% rename from rest_zrok_client/metadata/metadata_client.go rename to rest_client_zrok/metadata/metadata_client.go diff --git a/rest_zrok_client/metadata/version_parameters.go b/rest_client_zrok/metadata/version_parameters.go similarity index 100% rename from rest_zrok_client/metadata/version_parameters.go rename to rest_client_zrok/metadata/version_parameters.go diff --git a/rest_zrok_client/metadata/version_responses.go b/rest_client_zrok/metadata/version_responses.go similarity index 89% rename from rest_zrok_client/metadata/version_responses.go rename to rest_client_zrok/metadata/version_responses.go index b3ab40e5..b3e2cc84 100644 --- a/rest_zrok_client/metadata/version_responses.go +++ b/rest_client_zrok/metadata/version_responses.go @@ -12,7 +12,7 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/strfmt" - "github.com/openziti-test-kitchen/zrok/rest_model" + "github.com/openziti-test-kitchen/zrok/rest_model_zrok" ) // VersionReader is a Reader for the Version structure. @@ -44,19 +44,19 @@ func NewVersionOK() *VersionOK { retrieve the current server version */ type VersionOK struct { - Payload *rest_model.Version + Payload *rest_model_zrok.Version } func (o *VersionOK) Error() string { return fmt.Sprintf("[GET /version][%d] versionOK %+v", 200, o.Payload) } -func (o *VersionOK) GetPayload() *rest_model.Version { +func (o *VersionOK) GetPayload() *rest_model_zrok.Version { return o.Payload } func (o *VersionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(rest_model.Version) + o.Payload = new(rest_model_zrok.Version) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { diff --git a/rest_zrok_client/zrok_client.go b/rest_client_zrok/zrok_client.go similarity index 95% rename from rest_zrok_client/zrok_client.go rename to rest_client_zrok/zrok_client.go index d5af32b3..c7ecfde9 100644 --- a/rest_zrok_client/zrok_client.go +++ b/rest_client_zrok/zrok_client.go @@ -1,6 +1,6 @@ // Code generated by go-swagger; DO NOT EDIT. -package rest_zrok_client +package rest_client_zrok // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command @@ -10,8 +10,8 @@ import ( httptransport "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" - "github.com/openziti-test-kitchen/zrok/rest_zrok_client/identity" - "github.com/openziti-test-kitchen/zrok/rest_zrok_client/metadata" + "github.com/openziti-test-kitchen/zrok/rest_client_zrok/identity" + "github.com/openziti-test-kitchen/zrok/rest_client_zrok/metadata" ) // Default zrok HTTP client. diff --git a/rest_model/base_entity.go b/rest_model/base_entity.go deleted file mode 100644 index ff658d4c..00000000 --- a/rest_model/base_entity.go +++ /dev/null @@ -1,110 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package rest_model - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// BaseEntity Fields shared by all zrok entities -// -// swagger:model baseEntity -type BaseEntity struct { - - // created at - // Required: true - CreatedAt *string `json:"createdAt"` - - // id - // Required: true - ID *string `json:"id"` - - // updated at - // Required: true - // Format: date-time - UpdatedAt *strfmt.DateTime `json:"updatedAt"` -} - -// Validate validates this base entity -func (m *BaseEntity) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateCreatedAt(formats); err != nil { - res = append(res, err) - } - - if err := m.validateID(formats); err != nil { - res = append(res, err) - } - - if err := m.validateUpdatedAt(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *BaseEntity) validateCreatedAt(formats strfmt.Registry) error { - - if err := validate.Required("createdAt", "body", m.CreatedAt); err != nil { - return err - } - - return nil -} - -func (m *BaseEntity) validateID(formats strfmt.Registry) error { - - if err := validate.Required("id", "body", m.ID); err != nil { - return err - } - - return nil -} - -func (m *BaseEntity) validateUpdatedAt(formats strfmt.Registry) error { - - if err := validate.Required("updatedAt", "body", m.UpdatedAt); err != nil { - return err - } - - if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this base entity based on context it is used -func (m *BaseEntity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *BaseEntity) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *BaseEntity) UnmarshalBinary(b []byte) error { - var res BaseEntity - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/rest_model/account_request.go b/rest_model_zrok/account_request.go similarity index 98% rename from rest_model/account_request.go rename to rest_model_zrok/account_request.go index e2734912..7096ab0e 100644 --- a/rest_model/account_request.go +++ b/rest_model_zrok/account_request.go @@ -1,6 +1,6 @@ // Code generated by go-swagger; DO NOT EDIT. -package rest_model +package rest_model_zrok // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command diff --git a/rest_model/account_response.go b/rest_model_zrok/account_response.go similarity index 97% rename from rest_model/account_response.go rename to rest_model_zrok/account_response.go index acc63b70..f3d8a03e 100644 --- a/rest_model/account_response.go +++ b/rest_model_zrok/account_response.go @@ -1,6 +1,6 @@ // Code generated by go-swagger; DO NOT EDIT. -package rest_model +package rest_model_zrok // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command diff --git a/rest_model/enable_request.go b/rest_model_zrok/enable_request.go similarity index 97% rename from rest_model/enable_request.go rename to rest_model_zrok/enable_request.go index 11b9c568..ac458444 100644 --- a/rest_model/enable_request.go +++ b/rest_model_zrok/enable_request.go @@ -1,6 +1,6 @@ // Code generated by go-swagger; DO NOT EDIT. -package rest_model +package rest_model_zrok // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command diff --git a/rest_model/enable_response.go b/rest_model_zrok/enable_response.go similarity index 97% rename from rest_model/enable_response.go rename to rest_model_zrok/enable_response.go index 2bc2f89b..d2c218f4 100644 --- a/rest_model/enable_response.go +++ b/rest_model_zrok/enable_response.go @@ -1,6 +1,6 @@ // Code generated by go-swagger; DO NOT EDIT. -package rest_model +package rest_model_zrok // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command diff --git a/rest_model/version.go b/rest_model_zrok/version.go similarity index 97% rename from rest_model/version.go rename to rest_model_zrok/version.go index 80fa64ef..95673577 100644 --- a/rest_model/version.go +++ b/rest_model_zrok/version.go @@ -1,6 +1,6 @@ // Code generated by go-swagger; DO NOT EDIT. -package rest_model +package rest_model_zrok // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command diff --git a/rest_zrok_server/configure_zrok.go b/rest_server_zrok/configure_zrok.go similarity index 89% rename from rest_zrok_server/configure_zrok.go rename to rest_server_zrok/configure_zrok.go index 98f078fb..ce37b4c5 100644 --- a/rest_zrok_server/configure_zrok.go +++ b/rest_server_zrok/configure_zrok.go @@ -1,6 +1,6 @@ // This file is safe to edit. Once it exists it will not be overwritten -package rest_zrok_server +package rest_server_zrok import ( "crypto/tls" @@ -9,10 +9,10 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" - "github.com/openziti-test-kitchen/zrok/rest_zrok_server/operations" + "github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations" ) -//go:generate swagger generate server --target ../../zrok --name Zrok --spec ../specs/zrok.yml --model-package rest_model --server-package rest_zrok_server --principal interface{} +//go:generate swagger generate server --target ../../zrok --name Zrok --spec ../specs/zrok.yml --model-package rest_model_zrok --server-package rest_server_zrok --principal interface{} --exclude-main func configureFlags(api *operations.ZrokAPI) { // api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... } diff --git a/rest_zrok_server/doc.go b/rest_server_zrok/doc.go similarity index 82% rename from rest_zrok_server/doc.go rename to rest_server_zrok/doc.go index 9fcfcc50..a68bb270 100644 --- a/rest_zrok_server/doc.go +++ b/rest_server_zrok/doc.go @@ -1,6 +1,6 @@ // Code generated by go-swagger; DO NOT EDIT. -// Package rest_zrok_server zrok +// Package rest_server_zrok zrok // // zrok client access // Schemes: @@ -16,4 +16,4 @@ // - application/zrok.v1+json // // swagger:meta -package rest_zrok_server +package rest_server_zrok diff --git a/rest_zrok_server/embedded_spec.go b/rest_server_zrok/embedded_spec.go similarity index 99% rename from rest_zrok_server/embedded_spec.go rename to rest_server_zrok/embedded_spec.go index 98389616..3cb6a350 100644 --- a/rest_zrok_server/embedded_spec.go +++ b/rest_server_zrok/embedded_spec.go @@ -1,6 +1,6 @@ // Code generated by go-swagger; DO NOT EDIT. -package rest_zrok_server +package rest_server_zrok // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command diff --git a/rest_zrok_server/operations/identity/create_account.go b/rest_server_zrok/operations/identity/create_account.go similarity index 100% rename from rest_zrok_server/operations/identity/create_account.go rename to rest_server_zrok/operations/identity/create_account.go diff --git a/rest_zrok_server/operations/identity/create_account_parameters.go b/rest_server_zrok/operations/identity/create_account_parameters.go similarity index 93% rename from rest_zrok_server/operations/identity/create_account_parameters.go rename to rest_server_zrok/operations/identity/create_account_parameters.go index b21b71e4..f63625d3 100644 --- a/rest_zrok_server/operations/identity/create_account_parameters.go +++ b/rest_server_zrok/operations/identity/create_account_parameters.go @@ -14,7 +14,7 @@ import ( "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/validate" - "github.com/openziti-test-kitchen/zrok/rest_model" + "github.com/openziti-test-kitchen/zrok/rest_model_zrok" ) // NewCreateAccountParams creates a new CreateAccountParams object @@ -37,7 +37,7 @@ type CreateAccountParams struct { /* In: body */ - Body *rest_model.AccountRequest + Body *rest_model_zrok.AccountRequest } // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface @@ -51,7 +51,7 @@ func (o *CreateAccountParams) BindRequest(r *http.Request, route *middleware.Mat if runtime.HasBody(r) { defer r.Body.Close() - var body rest_model.AccountRequest + var body rest_model_zrok.AccountRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { res = append(res, errors.NewParseError("body", "body", "", err)) } else { diff --git a/rest_zrok_server/operations/identity/create_account_responses.go b/rest_server_zrok/operations/identity/create_account_responses.go similarity index 89% rename from rest_zrok_server/operations/identity/create_account_responses.go rename to rest_server_zrok/operations/identity/create_account_responses.go index 8588d37d..f66882e9 100644 --- a/rest_zrok_server/operations/identity/create_account_responses.go +++ b/rest_server_zrok/operations/identity/create_account_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - "github.com/openziti-test-kitchen/zrok/rest_model" + "github.com/openziti-test-kitchen/zrok/rest_model_zrok" ) // CreateAccountCreatedCode is the HTTP code returned for type CreateAccountCreated @@ -25,7 +25,7 @@ type CreateAccountCreated struct { /* In: Body */ - Payload *rest_model.AccountResponse `json:"body,omitempty"` + Payload *rest_model_zrok.AccountResponse `json:"body,omitempty"` } // NewCreateAccountCreated creates CreateAccountCreated with default headers values @@ -35,13 +35,13 @@ func NewCreateAccountCreated() *CreateAccountCreated { } // WithPayload adds the payload to the create account created response -func (o *CreateAccountCreated) WithPayload(payload *rest_model.AccountResponse) *CreateAccountCreated { +func (o *CreateAccountCreated) WithPayload(payload *rest_model_zrok.AccountResponse) *CreateAccountCreated { o.Payload = payload return o } // SetPayload sets the payload to the create account created response -func (o *CreateAccountCreated) SetPayload(payload *rest_model.AccountResponse) { +func (o *CreateAccountCreated) SetPayload(payload *rest_model_zrok.AccountResponse) { o.Payload = payload } diff --git a/rest_zrok_server/operations/identity/create_account_urlbuilder.go b/rest_server_zrok/operations/identity/create_account_urlbuilder.go similarity index 100% rename from rest_zrok_server/operations/identity/create_account_urlbuilder.go rename to rest_server_zrok/operations/identity/create_account_urlbuilder.go diff --git a/rest_zrok_server/operations/identity/enable.go b/rest_server_zrok/operations/identity/enable.go similarity index 100% rename from rest_zrok_server/operations/identity/enable.go rename to rest_server_zrok/operations/identity/enable.go diff --git a/rest_zrok_server/operations/identity/enable_parameters.go b/rest_server_zrok/operations/identity/enable_parameters.go similarity index 93% rename from rest_zrok_server/operations/identity/enable_parameters.go rename to rest_server_zrok/operations/identity/enable_parameters.go index d3a95c4b..8ce5097e 100644 --- a/rest_zrok_server/operations/identity/enable_parameters.go +++ b/rest_server_zrok/operations/identity/enable_parameters.go @@ -14,7 +14,7 @@ import ( "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/validate" - "github.com/openziti-test-kitchen/zrok/rest_model" + "github.com/openziti-test-kitchen/zrok/rest_model_zrok" ) // NewEnableParams creates a new EnableParams object @@ -37,7 +37,7 @@ type EnableParams struct { /* In: body */ - Body *rest_model.EnableRequest + Body *rest_model_zrok.EnableRequest } // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface @@ -51,7 +51,7 @@ func (o *EnableParams) BindRequest(r *http.Request, route *middleware.MatchedRou if runtime.HasBody(r) { defer r.Body.Close() - var body rest_model.EnableRequest + var body rest_model_zrok.EnableRequest if err := route.Consumer.Consume(r.Body, &body); err != nil { res = append(res, errors.NewParseError("body", "body", "", err)) } else { diff --git a/rest_zrok_server/operations/identity/enable_responses.go b/rest_server_zrok/operations/identity/enable_responses.go similarity index 89% rename from rest_zrok_server/operations/identity/enable_responses.go rename to rest_server_zrok/operations/identity/enable_responses.go index 1d0f3c19..bff32ae4 100644 --- a/rest_zrok_server/operations/identity/enable_responses.go +++ b/rest_server_zrok/operations/identity/enable_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - "github.com/openziti-test-kitchen/zrok/rest_model" + "github.com/openziti-test-kitchen/zrok/rest_model_zrok" ) // EnableCreatedCode is the HTTP code returned for type EnableCreated @@ -25,7 +25,7 @@ type EnableCreated struct { /* In: Body */ - Payload *rest_model.EnableResponse `json:"body,omitempty"` + Payload *rest_model_zrok.EnableResponse `json:"body,omitempty"` } // NewEnableCreated creates EnableCreated with default headers values @@ -35,13 +35,13 @@ func NewEnableCreated() *EnableCreated { } // WithPayload adds the payload to the enable created response -func (o *EnableCreated) WithPayload(payload *rest_model.EnableResponse) *EnableCreated { +func (o *EnableCreated) WithPayload(payload *rest_model_zrok.EnableResponse) *EnableCreated { o.Payload = payload return o } // SetPayload sets the payload to the enable created response -func (o *EnableCreated) SetPayload(payload *rest_model.EnableResponse) { +func (o *EnableCreated) SetPayload(payload *rest_model_zrok.EnableResponse) { o.Payload = payload } diff --git a/rest_zrok_server/operations/identity/enable_urlbuilder.go b/rest_server_zrok/operations/identity/enable_urlbuilder.go similarity index 100% rename from rest_zrok_server/operations/identity/enable_urlbuilder.go rename to rest_server_zrok/operations/identity/enable_urlbuilder.go diff --git a/rest_zrok_server/operations/metadata/version.go b/rest_server_zrok/operations/metadata/version.go similarity index 100% rename from rest_zrok_server/operations/metadata/version.go rename to rest_server_zrok/operations/metadata/version.go diff --git a/rest_zrok_server/operations/metadata/version_parameters.go b/rest_server_zrok/operations/metadata/version_parameters.go similarity index 100% rename from rest_zrok_server/operations/metadata/version_parameters.go rename to rest_server_zrok/operations/metadata/version_parameters.go diff --git a/rest_zrok_server/operations/metadata/version_responses.go b/rest_server_zrok/operations/metadata/version_responses.go similarity index 80% rename from rest_zrok_server/operations/metadata/version_responses.go rename to rest_server_zrok/operations/metadata/version_responses.go index 8334002e..e72eb235 100644 --- a/rest_zrok_server/operations/metadata/version_responses.go +++ b/rest_server_zrok/operations/metadata/version_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - "github.com/openziti-test-kitchen/zrok/rest_model" + "github.com/openziti-test-kitchen/zrok/rest_model_zrok" ) // VersionOKCode is the HTTP code returned for type VersionOK @@ -25,7 +25,7 @@ type VersionOK struct { /* In: Body */ - Payload *rest_model.Version `json:"body,omitempty"` + Payload *rest_model_zrok.Version `json:"body,omitempty"` } // NewVersionOK creates VersionOK with default headers values @@ -35,13 +35,13 @@ func NewVersionOK() *VersionOK { } // WithPayload adds the payload to the version o k response -func (o *VersionOK) WithPayload(payload *rest_model.Version) *VersionOK { +func (o *VersionOK) WithPayload(payload *rest_model_zrok.Version) *VersionOK { o.Payload = payload return o } // SetPayload sets the payload to the version o k response -func (o *VersionOK) SetPayload(payload *rest_model.Version) { +func (o *VersionOK) SetPayload(payload *rest_model_zrok.Version) { o.Payload = payload } diff --git a/rest_zrok_server/operations/metadata/version_urlbuilder.go b/rest_server_zrok/operations/metadata/version_urlbuilder.go similarity index 100% rename from rest_zrok_server/operations/metadata/version_urlbuilder.go rename to rest_server_zrok/operations/metadata/version_urlbuilder.go diff --git a/rest_zrok_server/operations/zrok_api.go b/rest_server_zrok/operations/zrok_api.go similarity index 98% rename from rest_zrok_server/operations/zrok_api.go rename to rest_server_zrok/operations/zrok_api.go index 21bd859f..ee31208f 100644 --- a/rest_zrok_server/operations/zrok_api.go +++ b/rest_server_zrok/operations/zrok_api.go @@ -19,8 +19,8 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/openziti-test-kitchen/zrok/rest_zrok_server/operations/identity" - "github.com/openziti-test-kitchen/zrok/rest_zrok_server/operations/metadata" + "github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/identity" + "github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/metadata" ) // NewZrokAPI creates a new Zrok instance diff --git a/rest_zrok_server/server.go b/rest_server_zrok/server.go similarity index 99% rename from rest_zrok_server/server.go rename to rest_server_zrok/server.go index 73178707..3914daf2 100644 --- a/rest_zrok_server/server.go +++ b/rest_server_zrok/server.go @@ -1,6 +1,6 @@ // Code generated by go-swagger; DO NOT EDIT. -package rest_zrok_server +package rest_server_zrok import ( "context" @@ -25,7 +25,7 @@ import ( flags "github.com/jessevdk/go-flags" "golang.org/x/net/netutil" - "github.com/openziti-test-kitchen/zrok/rest_zrok_server/operations" + "github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations" ) const ( diff --git a/rest_zrok_client/metadata/get_parameters.go b/rest_zrok_client/metadata/get_parameters.go deleted file mode 100644 index 1fcb910c..00000000 --- a/rest_zrok_client/metadata/get_parameters.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package metadata - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetParams creates a new GetParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetParams() *GetParams { - return &GetParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetParamsWithTimeout creates a new GetParams object -// with the ability to set a timeout on a request. -func NewGetParamsWithTimeout(timeout time.Duration) *GetParams { - return &GetParams{ - timeout: timeout, - } -} - -// NewGetParamsWithContext creates a new GetParams object -// with the ability to set a context for a request. -func NewGetParamsWithContext(ctx context.Context) *GetParams { - return &GetParams{ - Context: ctx, - } -} - -// NewGetParamsWithHTTPClient creates a new GetParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetParamsWithHTTPClient(client *http.Client) *GetParams { - return &GetParams{ - HTTPClient: client, - } -} - -/* GetParams contains all the parameters to send to the API endpoint - for the get operation. - - Typically these are written to a http.Request. -*/ -type GetParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetParams) WithDefaults() *GetParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get params -func (o *GetParams) WithTimeout(timeout time.Duration) *GetParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get params -func (o *GetParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get params -func (o *GetParams) WithContext(ctx context.Context) *GetParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get params -func (o *GetParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get params -func (o *GetParams) WithHTTPClient(client *http.Client) *GetParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get params -func (o *GetParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *GetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/rest_zrok_client/metadata/get_responses.go b/rest_zrok_client/metadata/get_responses.go deleted file mode 100644 index e5c264b5..00000000 --- a/rest_zrok_client/metadata/get_responses.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package metadata - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/openziti-test-kitchen/zrok/rest_model" -) - -// GetReader is a Reader for the Get structure. -type GetReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - 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()) - } -} - -// NewGetOK creates a GetOK with default headers values -func NewGetOK() *GetOK { - return &GetOK{} -} - -/* GetOK describes a response with status code 200, with default header values. - -retrieve the current server version -*/ -type GetOK struct { - Payload *rest_model.Version -} - -func (o *GetOK) Error() string { - return fmt.Sprintf("[GET /][%d] getOK %+v", 200, o.Payload) -} -func (o *GetOK) GetPayload() *rest_model.Version { - return o.Payload -} - -func (o *GetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(rest_model.Version) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/rest_zrok_server/operations/metadata/get.go b/rest_zrok_server/operations/metadata/get.go deleted file mode 100644 index 92938d32..00000000 --- a/rest_zrok_server/operations/metadata/get.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package metadata - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// GetHandlerFunc turns a function with the right signature into a get handler -type GetHandlerFunc func(GetParams) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetHandlerFunc) Handle(params GetParams) middleware.Responder { - return fn(params) -} - -// GetHandler interface for that can handle valid get params -type GetHandler interface { - Handle(GetParams) middleware.Responder -} - -// NewGet creates a new http.Handler for the get operation -func NewGet(ctx *middleware.Context, handler GetHandler) *Get { - return &Get{Context: ctx, Handler: handler} -} - -/* Get swagger:route GET / metadata get - -Get get API - -*/ -type Get struct { - Context *middleware.Context - Handler GetHandler -} - -func (o *Get) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetParams() - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/rest_zrok_server/operations/metadata/get_parameters.go b/rest_zrok_server/operations/metadata/get_parameters.go deleted file mode 100644 index 49a2f77b..00000000 --- a/rest_zrok_server/operations/metadata/get_parameters.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package metadata - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" -) - -// NewGetParams creates a new GetParams object -// -// There are no default values defined in the spec. -func NewGetParams() GetParams { - - return GetParams{} -} - -// GetParams contains all the bound params for the get operation -// typically these are obtained from a http.Request -// -// swagger:parameters Get -type GetParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewGetParams() beforehand. -func (o *GetParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/rest_zrok_server/operations/metadata/get_responses.go b/rest_zrok_server/operations/metadata/get_responses.go deleted file mode 100644 index 910fa250..00000000 --- a/rest_zrok_server/operations/metadata/get_responses.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package metadata - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/openziti-test-kitchen/zrok/rest_model" -) - -// GetOKCode is the HTTP code returned for type GetOK -const GetOKCode int = 200 - -/*GetOK retrieve the current server version - -swagger:response getOK -*/ -type GetOK struct { - - /* - In: Body - */ - Payload *rest_model.Version `json:"body,omitempty"` -} - -// NewGetOK creates GetOK with default headers values -func NewGetOK() *GetOK { - - return &GetOK{} -} - -// WithPayload adds the payload to the get o k response -func (o *GetOK) WithPayload(payload *rest_model.Version) *GetOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get o k response -func (o *GetOK) SetPayload(payload *rest_model.Version) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/rest_zrok_server/operations/metadata/get_urlbuilder.go b/rest_zrok_server/operations/metadata/get_urlbuilder.go deleted file mode 100644 index ed327125..00000000 --- a/rest_zrok_server/operations/metadata/get_urlbuilder.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package metadata - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// GetURL generates an URL for the get operation -type GetURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetURL) WithBasePath(bp string) *GetURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *GetURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/" - - _basePath := o._basePath - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *GetURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *GetURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -}