diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..5384d96 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,3 @@ +linters: + enable: + - gosec diff --git a/Makefile b/Makefile index a9f3578..8b853fd 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ ifaces: .PHONY: mocks mocks: rm -rf mocks/* - mockery -all + mockery --all lint: ./scripts/lint.sh diff --git a/client/c_o_r_s/cors_client.go b/client/c_o_r_s/cors_client.go index 01e0f33..05269f4 100644 --- a/client/c_o_r_s/cors_client.go +++ b/client/c_o_r_s/cors_client.go @@ -9,6 +9,7 @@ import ( "fmt" "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" ) @@ -17,6 +18,31 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientServi return &Client{transport: transport, formats: formats} } +// New creates a new c o r s API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new c o r s API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + /* Client for c o r s API */ @@ -25,42 +51,41 @@ type Client struct { formats strfmt.Registry } +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + // ClientService is the interface for Client methods type ClientService interface { - OptionsAccounts(params *OptionsAccountsParams) (*OptionsAccountsOK, error) + OptionsAccounts(params *OptionsAccountsParams, opts ...ClientOption) (*OptionsAccountsOK, error) - OptionsAccountsID(params *OptionsAccountsIDParams) (*OptionsAccountsIDOK, error) + OptionsAccountsID(params *OptionsAccountsIDParams, opts ...ClientOption) (*OptionsAccountsIDOK, error) - OptionsAuth(params *OptionsAuthParams) (*OptionsAuthOK, error) + OptionsAuth(params *OptionsAuthParams, opts ...ClientOption) (*OptionsAuthOK, error) - OptionsAuthFile(params *OptionsAuthFileParams) (*OptionsAuthFileOK, error) + OptionsAuthFile(params *OptionsAuthFileParams, opts ...ClientOption) (*OptionsAuthFileOK, error) - OptionsLeases(params *OptionsLeasesParams) (*OptionsLeasesOK, error) + OptionsLeases(params *OptionsLeasesParams, opts ...ClientOption) (*OptionsLeasesOK, error) - OptionsLeasesAuth(params *OptionsLeasesAuthParams) (*OptionsLeasesAuthOK, error) + OptionsLeasesID(params *OptionsLeasesIDParams, opts ...ClientOption) (*OptionsLeasesIDOK, error) - OptionsLeasesID(params *OptionsLeasesIDParams) (*OptionsLeasesIDOK, error) + OptionsLeasesIDAuth(params *OptionsLeasesIDAuthParams, opts ...ClientOption) (*OptionsLeasesIDAuthOK, error) - OptionsLeasesIDAuth(params *OptionsLeasesIDAuthParams) (*OptionsLeasesIDAuthOK, error) - - OptionsUsage(params *OptionsUsageParams) (*OptionsUsageOK, error) + OptionsUsage(params *OptionsUsageParams, opts ...ClientOption) (*OptionsUsageOK, error) SetTransport(transport runtime.ClientTransport) } /* - OptionsAccounts cs o r s support - - Enable CORS by returning correct headers +OptionsAccounts cs o r s support +Enable CORS by returning correct headers */ -func (a *Client) OptionsAccounts(params *OptionsAccountsParams) (*OptionsAccountsOK, error) { +func (a *Client) OptionsAccounts(params *OptionsAccountsParams, opts ...ClientOption) (*OptionsAccountsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewOptionsAccountsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "OptionsAccounts", Method: "OPTIONS", PathPattern: "/accounts", @@ -71,7 +96,12 @@ func (a *Client) OptionsAccounts(params *OptionsAccountsParams) (*OptionsAccount Reader: &OptionsAccountsReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -86,18 +116,16 @@ func (a *Client) OptionsAccounts(params *OptionsAccountsParams) (*OptionsAccount } /* - OptionsAccountsID cs o r s support - - Enable CORS by returning correct headers +OptionsAccountsID cs o r s support +Enable CORS by returning correct headers */ -func (a *Client) OptionsAccountsID(params *OptionsAccountsIDParams) (*OptionsAccountsIDOK, error) { +func (a *Client) OptionsAccountsID(params *OptionsAccountsIDParams, opts ...ClientOption) (*OptionsAccountsIDOK, error) { // TODO: Validate the params before sending if params == nil { params = NewOptionsAccountsIDParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "OptionsAccountsID", Method: "OPTIONS", PathPattern: "/accounts/{id}", @@ -108,7 +136,12 @@ func (a *Client) OptionsAccountsID(params *OptionsAccountsIDParams) (*OptionsAcc Reader: &OptionsAccountsIDReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -123,18 +156,16 @@ func (a *Client) OptionsAccountsID(params *OptionsAccountsIDParams) (*OptionsAcc } /* - OptionsAuth cs o r s support - - Enable CORS by returning correct headers +OptionsAuth cs o r s support +Enable CORS by returning correct headers */ -func (a *Client) OptionsAuth(params *OptionsAuthParams) (*OptionsAuthOK, error) { +func (a *Client) OptionsAuth(params *OptionsAuthParams, opts ...ClientOption) (*OptionsAuthOK, error) { // TODO: Validate the params before sending if params == nil { params = NewOptionsAuthParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "OptionsAuth", Method: "OPTIONS", PathPattern: "/auth", @@ -145,7 +176,12 @@ func (a *Client) OptionsAuth(params *OptionsAuthParams) (*OptionsAuthOK, error) Reader: &OptionsAuthReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -160,18 +196,16 @@ func (a *Client) OptionsAuth(params *OptionsAuthParams) (*OptionsAuthOK, error) } /* - OptionsAuthFile cs o r s support - - Enable CORS by returning correct headers +OptionsAuthFile cs o r s support +Enable CORS by returning correct headers */ -func (a *Client) OptionsAuthFile(params *OptionsAuthFileParams) (*OptionsAuthFileOK, error) { +func (a *Client) OptionsAuthFile(params *OptionsAuthFileParams, opts ...ClientOption) (*OptionsAuthFileOK, error) { // TODO: Validate the params before sending if params == nil { params = NewOptionsAuthFileParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "OptionsAuthFile", Method: "OPTIONS", PathPattern: "/auth/{file+}", @@ -182,7 +216,12 @@ func (a *Client) OptionsAuthFile(params *OptionsAuthFileParams) (*OptionsAuthFil Reader: &OptionsAuthFileReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -197,18 +236,16 @@ func (a *Client) OptionsAuthFile(params *OptionsAuthFileParams) (*OptionsAuthFil } /* - OptionsLeases cs o r s support - - Enable CORS by returning correct headers +OptionsLeases cs o r s support +Enable CORS by returning correct headers */ -func (a *Client) OptionsLeases(params *OptionsLeasesParams) (*OptionsLeasesOK, error) { +func (a *Client) OptionsLeases(params *OptionsLeasesParams, opts ...ClientOption) (*OptionsLeasesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewOptionsLeasesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "OptionsLeases", Method: "OPTIONS", PathPattern: "/leases", @@ -219,70 +256,36 @@ func (a *Client) OptionsLeases(params *OptionsLeasesParams) (*OptionsLeasesOK, e Reader: &OptionsLeasesReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - success, ok := result.(*OptionsLeasesOK) - if ok { - return success, nil } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for OptionsLeases: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* - OptionsLeasesAuth cs o r s support - - Enable CORS by returning correct headers - -*/ -func (a *Client) OptionsLeasesAuth(params *OptionsLeasesAuthParams) (*OptionsLeasesAuthOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewOptionsLeasesAuthParams() + for _, opt := range opts { + opt(op) } - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "OptionsLeasesAuth", - Method: "OPTIONS", - PathPattern: "/leases/auth", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"https"}, - Params: params, - Reader: &OptionsLeasesAuthReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - }) + result, err := a.transport.Submit(op) if err != nil { return nil, err } - success, ok := result.(*OptionsLeasesAuthOK) + success, ok := result.(*OptionsLeasesOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for OptionsLeasesAuth: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for OptionsLeases: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } /* - OptionsLeasesID cs o r s support - - Enable CORS by returning correct headers +OptionsLeasesID cs o r s support +Enable CORS by returning correct headers */ -func (a *Client) OptionsLeasesID(params *OptionsLeasesIDParams) (*OptionsLeasesIDOK, error) { +func (a *Client) OptionsLeasesID(params *OptionsLeasesIDParams, opts ...ClientOption) (*OptionsLeasesIDOK, error) { // TODO: Validate the params before sending if params == nil { params = NewOptionsLeasesIDParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "OptionsLeasesID", Method: "OPTIONS", PathPattern: "/leases/{id}", @@ -293,7 +296,12 @@ func (a *Client) OptionsLeasesID(params *OptionsLeasesIDParams) (*OptionsLeasesI Reader: &OptionsLeasesIDReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -308,18 +316,16 @@ func (a *Client) OptionsLeasesID(params *OptionsLeasesIDParams) (*OptionsLeasesI } /* - OptionsLeasesIDAuth cs o r s support - - Enable CORS by returning correct headers +OptionsLeasesIDAuth cs o r s support +Enable CORS by returning correct headers */ -func (a *Client) OptionsLeasesIDAuth(params *OptionsLeasesIDAuthParams) (*OptionsLeasesIDAuthOK, error) { +func (a *Client) OptionsLeasesIDAuth(params *OptionsLeasesIDAuthParams, opts ...ClientOption) (*OptionsLeasesIDAuthOK, error) { // TODO: Validate the params before sending if params == nil { params = NewOptionsLeasesIDAuthParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "OptionsLeasesIDAuth", Method: "OPTIONS", PathPattern: "/leases/{id}/auth", @@ -330,7 +336,12 @@ func (a *Client) OptionsLeasesIDAuth(params *OptionsLeasesIDAuthParams) (*Option Reader: &OptionsLeasesIDAuthReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -345,18 +356,16 @@ func (a *Client) OptionsLeasesIDAuth(params *OptionsLeasesIDAuthParams) (*Option } /* - OptionsUsage cs o r s support - - Enable CORS by returning correct headers +OptionsUsage cs o r s support +Enable CORS by returning correct headers */ -func (a *Client) OptionsUsage(params *OptionsUsageParams) (*OptionsUsageOK, error) { +func (a *Client) OptionsUsage(params *OptionsUsageParams, opts ...ClientOption) (*OptionsUsageOK, error) { // TODO: Validate the params before sending if params == nil { params = NewOptionsUsageParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "OptionsUsage", Method: "OPTIONS", PathPattern: "/usage", @@ -367,7 +376,12 @@ func (a *Client) OptionsUsage(params *OptionsUsageParams) (*OptionsUsageOK, erro Reader: &OptionsUsageReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } diff --git a/client/c_o_r_s/options_accounts_id_parameters.go b/client/c_o_r_s/options_accounts_id_parameters.go index eb7da5f..7e3ef5a 100644 --- a/client/c_o_r_s/options_accounts_id_parameters.go +++ b/client/c_o_r_s/options_accounts_id_parameters.go @@ -13,51 +13,51 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewOptionsAccountsIDParams creates a new OptionsAccountsIDParams object -// with the default values initialized. +// NewOptionsAccountsIDParams creates a new OptionsAccountsIDParams 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 NewOptionsAccountsIDParams() *OptionsAccountsIDParams { - return &OptionsAccountsIDParams{ - timeout: cr.DefaultTimeout, } } // NewOptionsAccountsIDParamsWithTimeout creates a new OptionsAccountsIDParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewOptionsAccountsIDParamsWithTimeout(timeout time.Duration) *OptionsAccountsIDParams { - return &OptionsAccountsIDParams{ - timeout: timeout, } } // NewOptionsAccountsIDParamsWithContext creates a new OptionsAccountsIDParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewOptionsAccountsIDParamsWithContext(ctx context.Context) *OptionsAccountsIDParams { - return &OptionsAccountsIDParams{ - Context: ctx, } } // NewOptionsAccountsIDParamsWithHTTPClient creates a new OptionsAccountsIDParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewOptionsAccountsIDParamsWithHTTPClient(client *http.Client) *OptionsAccountsIDParams { - return &OptionsAccountsIDParams{ HTTPClient: client, } } -/*OptionsAccountsIDParams contains all the parameters to send to the API endpoint -for the options accounts ID operation typically these are written to a http.Request +/* +OptionsAccountsIDParams contains all the parameters to send to the API endpoint + + for the options accounts ID operation. + + Typically these are written to a http.Request. */ type OptionsAccountsIDParams struct { timeout time.Duration @@ -65,6 +65,21 @@ type OptionsAccountsIDParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the options accounts ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *OptionsAccountsIDParams) WithDefaults() *OptionsAccountsIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the options accounts ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *OptionsAccountsIDParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the options accounts ID params func (o *OptionsAccountsIDParams) WithTimeout(timeout time.Duration) *OptionsAccountsIDParams { o.SetTimeout(timeout) diff --git a/client/c_o_r_s/options_accounts_id_responses.go b/client/c_o_r_s/options_accounts_id_responses.go index fdc74ee..2e3c893 100644 --- a/client/c_o_r_s/options_accounts_id_responses.go +++ b/client/c_o_r_s/options_accounts_id_responses.go @@ -9,8 +9,7 @@ import ( "fmt" "github.com/go-openapi/runtime" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) // OptionsAccountsIDReader is a Reader for the OptionsAccountsID structure. @@ -27,9 +26,8 @@ func (o *OptionsAccountsIDReader) ReadResponse(response runtime.ClientResponse, return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[OPTIONS /accounts/{id}] OptionsAccountsID", response, response.Code()) } } @@ -38,32 +36,77 @@ func NewOptionsAccountsIDOK() *OptionsAccountsIDOK { return &OptionsAccountsIDOK{} } -/*OptionsAccountsIDOK handles this case with default header values. +/* +OptionsAccountsIDOK describes a response with status code 200, with default header values. Default response for CORS method */ type OptionsAccountsIDOK struct { AccessControlAllowHeaders string - AccessControlAllowMethods string + AccessControlAllowOrigin string +} + +// IsSuccess returns true when this options accounts Id o k response has a 2xx status code +func (o *OptionsAccountsIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this options accounts Id o k response has a 3xx status code +func (o *OptionsAccountsIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this options accounts Id o k response has a 4xx status code +func (o *OptionsAccountsIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this options accounts Id o k response has a 5xx status code +func (o *OptionsAccountsIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this options accounts Id o k response a status code equal to that given +func (o *OptionsAccountsIDOK) IsCode(code int) bool { + return code == 200 +} - AccessControlAllowOrigin string +// Code gets the status code for the options accounts Id o k response +func (o *OptionsAccountsIDOK) Code() int { + return 200 } func (o *OptionsAccountsIDOK) Error() string { - return fmt.Sprintf("[OPTIONS /accounts/{id}][%d] optionsAccountsIdOK ", 200) + return fmt.Sprintf("[OPTIONS /accounts/{id}][%d] optionsAccountsIdOK", 200) +} + +func (o *OptionsAccountsIDOK) String() string { + return fmt.Sprintf("[OPTIONS /accounts/{id}][%d] optionsAccountsIdOK", 200) } func (o *OptionsAccountsIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") + + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } + + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } return nil } diff --git a/client/c_o_r_s/options_accounts_parameters.go b/client/c_o_r_s/options_accounts_parameters.go index a06ca40..a766918 100644 --- a/client/c_o_r_s/options_accounts_parameters.go +++ b/client/c_o_r_s/options_accounts_parameters.go @@ -13,51 +13,51 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewOptionsAccountsParams creates a new OptionsAccountsParams object -// with the default values initialized. +// NewOptionsAccountsParams creates a new OptionsAccountsParams 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 NewOptionsAccountsParams() *OptionsAccountsParams { - return &OptionsAccountsParams{ - timeout: cr.DefaultTimeout, } } // NewOptionsAccountsParamsWithTimeout creates a new OptionsAccountsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewOptionsAccountsParamsWithTimeout(timeout time.Duration) *OptionsAccountsParams { - return &OptionsAccountsParams{ - timeout: timeout, } } // NewOptionsAccountsParamsWithContext creates a new OptionsAccountsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewOptionsAccountsParamsWithContext(ctx context.Context) *OptionsAccountsParams { - return &OptionsAccountsParams{ - Context: ctx, } } // NewOptionsAccountsParamsWithHTTPClient creates a new OptionsAccountsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewOptionsAccountsParamsWithHTTPClient(client *http.Client) *OptionsAccountsParams { - return &OptionsAccountsParams{ HTTPClient: client, } } -/*OptionsAccountsParams contains all the parameters to send to the API endpoint -for the options accounts operation typically these are written to a http.Request +/* +OptionsAccountsParams contains all the parameters to send to the API endpoint + + for the options accounts operation. + + Typically these are written to a http.Request. */ type OptionsAccountsParams struct { timeout time.Duration @@ -65,6 +65,21 @@ type OptionsAccountsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the options accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *OptionsAccountsParams) WithDefaults() *OptionsAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the options accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *OptionsAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the options accounts params func (o *OptionsAccountsParams) WithTimeout(timeout time.Duration) *OptionsAccountsParams { o.SetTimeout(timeout) diff --git a/client/c_o_r_s/options_accounts_responses.go b/client/c_o_r_s/options_accounts_responses.go index f074d06..8a77bc7 100644 --- a/client/c_o_r_s/options_accounts_responses.go +++ b/client/c_o_r_s/options_accounts_responses.go @@ -9,8 +9,7 @@ import ( "fmt" "github.com/go-openapi/runtime" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) // OptionsAccountsReader is a Reader for the OptionsAccounts structure. @@ -27,9 +26,8 @@ func (o *OptionsAccountsReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[OPTIONS /accounts] OptionsAccounts", response, response.Code()) } } @@ -38,32 +36,77 @@ func NewOptionsAccountsOK() *OptionsAccountsOK { return &OptionsAccountsOK{} } -/*OptionsAccountsOK handles this case with default header values. +/* +OptionsAccountsOK describes a response with status code 200, with default header values. Default response for CORS method */ type OptionsAccountsOK struct { AccessControlAllowHeaders string - AccessControlAllowMethods string + AccessControlAllowOrigin string +} + +// IsSuccess returns true when this options accounts o k response has a 2xx status code +func (o *OptionsAccountsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this options accounts o k response has a 3xx status code +func (o *OptionsAccountsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this options accounts o k response has a 4xx status code +func (o *OptionsAccountsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this options accounts o k response has a 5xx status code +func (o *OptionsAccountsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this options accounts o k response a status code equal to that given +func (o *OptionsAccountsOK) IsCode(code int) bool { + return code == 200 +} - AccessControlAllowOrigin string +// Code gets the status code for the options accounts o k response +func (o *OptionsAccountsOK) Code() int { + return 200 } func (o *OptionsAccountsOK) Error() string { - return fmt.Sprintf("[OPTIONS /accounts][%d] optionsAccountsOK ", 200) + return fmt.Sprintf("[OPTIONS /accounts][%d] optionsAccountsOK", 200) +} + +func (o *OptionsAccountsOK) String() string { + return fmt.Sprintf("[OPTIONS /accounts][%d] optionsAccountsOK", 200) } func (o *OptionsAccountsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") + + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } + + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } return nil } diff --git a/client/c_o_r_s/options_auth_file_parameters.go b/client/c_o_r_s/options_auth_file_parameters.go index 774d03b..bdb5745 100644 --- a/client/c_o_r_s/options_auth_file_parameters.go +++ b/client/c_o_r_s/options_auth_file_parameters.go @@ -13,51 +13,51 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewOptionsAuthFileParams creates a new OptionsAuthFileParams object -// with the default values initialized. +// NewOptionsAuthFileParams creates a new OptionsAuthFileParams 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 NewOptionsAuthFileParams() *OptionsAuthFileParams { - return &OptionsAuthFileParams{ - timeout: cr.DefaultTimeout, } } // NewOptionsAuthFileParamsWithTimeout creates a new OptionsAuthFileParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewOptionsAuthFileParamsWithTimeout(timeout time.Duration) *OptionsAuthFileParams { - return &OptionsAuthFileParams{ - timeout: timeout, } } // NewOptionsAuthFileParamsWithContext creates a new OptionsAuthFileParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewOptionsAuthFileParamsWithContext(ctx context.Context) *OptionsAuthFileParams { - return &OptionsAuthFileParams{ - Context: ctx, } } // NewOptionsAuthFileParamsWithHTTPClient creates a new OptionsAuthFileParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewOptionsAuthFileParamsWithHTTPClient(client *http.Client) *OptionsAuthFileParams { - return &OptionsAuthFileParams{ HTTPClient: client, } } -/*OptionsAuthFileParams contains all the parameters to send to the API endpoint -for the options auth file operation typically these are written to a http.Request +/* +OptionsAuthFileParams contains all the parameters to send to the API endpoint + + for the options auth file operation. + + Typically these are written to a http.Request. */ type OptionsAuthFileParams struct { timeout time.Duration @@ -65,6 +65,21 @@ type OptionsAuthFileParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the options auth file params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *OptionsAuthFileParams) WithDefaults() *OptionsAuthFileParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the options auth file params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *OptionsAuthFileParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the options auth file params func (o *OptionsAuthFileParams) WithTimeout(timeout time.Duration) *OptionsAuthFileParams { o.SetTimeout(timeout) diff --git a/client/c_o_r_s/options_auth_file_responses.go b/client/c_o_r_s/options_auth_file_responses.go index 5096b89..66e7ae2 100644 --- a/client/c_o_r_s/options_auth_file_responses.go +++ b/client/c_o_r_s/options_auth_file_responses.go @@ -9,8 +9,7 @@ import ( "fmt" "github.com/go-openapi/runtime" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) // OptionsAuthFileReader is a Reader for the OptionsAuthFile structure. @@ -27,9 +26,8 @@ func (o *OptionsAuthFileReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[OPTIONS /auth/{file+}] OptionsAuthFile", response, response.Code()) } } @@ -38,32 +36,77 @@ func NewOptionsAuthFileOK() *OptionsAuthFileOK { return &OptionsAuthFileOK{} } -/*OptionsAuthFileOK handles this case with default header values. +/* +OptionsAuthFileOK describes a response with status code 200, with default header values. Default response for CORS method */ type OptionsAuthFileOK struct { AccessControlAllowHeaders string - AccessControlAllowMethods string + AccessControlAllowOrigin string +} + +// IsSuccess returns true when this options auth file o k response has a 2xx status code +func (o *OptionsAuthFileOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this options auth file o k response has a 3xx status code +func (o *OptionsAuthFileOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this options auth file o k response has a 4xx status code +func (o *OptionsAuthFileOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this options auth file o k response has a 5xx status code +func (o *OptionsAuthFileOK) IsServerError() bool { + return false +} + +// IsCode returns true when this options auth file o k response a status code equal to that given +func (o *OptionsAuthFileOK) IsCode(code int) bool { + return code == 200 +} - AccessControlAllowOrigin string +// Code gets the status code for the options auth file o k response +func (o *OptionsAuthFileOK) Code() int { + return 200 } func (o *OptionsAuthFileOK) Error() string { - return fmt.Sprintf("[OPTIONS /auth/{file+}][%d] optionsAuthFileOK ", 200) + return fmt.Sprintf("[OPTIONS /auth/{file+}][%d] optionsAuthFileOK", 200) +} + +func (o *OptionsAuthFileOK) String() string { + return fmt.Sprintf("[OPTIONS /auth/{file+}][%d] optionsAuthFileOK", 200) } func (o *OptionsAuthFileOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") + + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } + + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } return nil } diff --git a/client/c_o_r_s/options_auth_parameters.go b/client/c_o_r_s/options_auth_parameters.go index 638610e..f95caa3 100644 --- a/client/c_o_r_s/options_auth_parameters.go +++ b/client/c_o_r_s/options_auth_parameters.go @@ -13,51 +13,51 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewOptionsAuthParams creates a new OptionsAuthParams object -// with the default values initialized. +// NewOptionsAuthParams creates a new OptionsAuthParams 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 NewOptionsAuthParams() *OptionsAuthParams { - return &OptionsAuthParams{ - timeout: cr.DefaultTimeout, } } // NewOptionsAuthParamsWithTimeout creates a new OptionsAuthParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewOptionsAuthParamsWithTimeout(timeout time.Duration) *OptionsAuthParams { - return &OptionsAuthParams{ - timeout: timeout, } } // NewOptionsAuthParamsWithContext creates a new OptionsAuthParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewOptionsAuthParamsWithContext(ctx context.Context) *OptionsAuthParams { - return &OptionsAuthParams{ - Context: ctx, } } // NewOptionsAuthParamsWithHTTPClient creates a new OptionsAuthParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewOptionsAuthParamsWithHTTPClient(client *http.Client) *OptionsAuthParams { - return &OptionsAuthParams{ HTTPClient: client, } } -/*OptionsAuthParams contains all the parameters to send to the API endpoint -for the options auth operation typically these are written to a http.Request +/* +OptionsAuthParams contains all the parameters to send to the API endpoint + + for the options auth operation. + + Typically these are written to a http.Request. */ type OptionsAuthParams struct { timeout time.Duration @@ -65,6 +65,21 @@ type OptionsAuthParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the options auth params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *OptionsAuthParams) WithDefaults() *OptionsAuthParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the options auth params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *OptionsAuthParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the options auth params func (o *OptionsAuthParams) WithTimeout(timeout time.Duration) *OptionsAuthParams { o.SetTimeout(timeout) diff --git a/client/c_o_r_s/options_auth_responses.go b/client/c_o_r_s/options_auth_responses.go index 44b4ac2..53bae52 100644 --- a/client/c_o_r_s/options_auth_responses.go +++ b/client/c_o_r_s/options_auth_responses.go @@ -9,8 +9,7 @@ import ( "fmt" "github.com/go-openapi/runtime" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) // OptionsAuthReader is a Reader for the OptionsAuth structure. @@ -27,9 +26,8 @@ func (o *OptionsAuthReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[OPTIONS /auth] OptionsAuth", response, response.Code()) } } @@ -38,32 +36,77 @@ func NewOptionsAuthOK() *OptionsAuthOK { return &OptionsAuthOK{} } -/*OptionsAuthOK handles this case with default header values. +/* +OptionsAuthOK describes a response with status code 200, with default header values. Default response for CORS method */ type OptionsAuthOK struct { AccessControlAllowHeaders string - AccessControlAllowMethods string + AccessControlAllowOrigin string +} + +// IsSuccess returns true when this options auth o k response has a 2xx status code +func (o *OptionsAuthOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this options auth o k response has a 3xx status code +func (o *OptionsAuthOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this options auth o k response has a 4xx status code +func (o *OptionsAuthOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this options auth o k response has a 5xx status code +func (o *OptionsAuthOK) IsServerError() bool { + return false +} + +// IsCode returns true when this options auth o k response a status code equal to that given +func (o *OptionsAuthOK) IsCode(code int) bool { + return code == 200 +} - AccessControlAllowOrigin string +// Code gets the status code for the options auth o k response +func (o *OptionsAuthOK) Code() int { + return 200 } func (o *OptionsAuthOK) Error() string { - return fmt.Sprintf("[OPTIONS /auth][%d] optionsAuthOK ", 200) + return fmt.Sprintf("[OPTIONS /auth][%d] optionsAuthOK", 200) +} + +func (o *OptionsAuthOK) String() string { + return fmt.Sprintf("[OPTIONS /auth][%d] optionsAuthOK", 200) } func (o *OptionsAuthOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") + + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } + + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } return nil } diff --git a/client/c_o_r_s/options_leases_auth_parameters.go b/client/c_o_r_s/options_leases_auth_parameters.go deleted file mode 100644 index 201ab97..0000000 --- a/client/c_o_r_s/options_leases_auth_parameters.go +++ /dev/null @@ -1,113 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package c_o_r_s - -// 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" - - strfmt "github.com/go-openapi/strfmt" -) - -// NewOptionsLeasesAuthParams creates a new OptionsLeasesAuthParams object -// with the default values initialized. -func NewOptionsLeasesAuthParams() *OptionsLeasesAuthParams { - - return &OptionsLeasesAuthParams{ - - timeout: cr.DefaultTimeout, - } -} - -// NewOptionsLeasesAuthParamsWithTimeout creates a new OptionsLeasesAuthParams object -// with the default values initialized, and the ability to set a timeout on a request -func NewOptionsLeasesAuthParamsWithTimeout(timeout time.Duration) *OptionsLeasesAuthParams { - - return &OptionsLeasesAuthParams{ - - timeout: timeout, - } -} - -// NewOptionsLeasesAuthParamsWithContext creates a new OptionsLeasesAuthParams object -// with the default values initialized, and the ability to set a context for a request -func NewOptionsLeasesAuthParamsWithContext(ctx context.Context) *OptionsLeasesAuthParams { - - return &OptionsLeasesAuthParams{ - - Context: ctx, - } -} - -// NewOptionsLeasesAuthParamsWithHTTPClient creates a new OptionsLeasesAuthParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request -func NewOptionsLeasesAuthParamsWithHTTPClient(client *http.Client) *OptionsLeasesAuthParams { - - return &OptionsLeasesAuthParams{ - HTTPClient: client, - } -} - -/*OptionsLeasesAuthParams contains all the parameters to send to the API endpoint -for the options leases auth operation typically these are written to a http.Request -*/ -type OptionsLeasesAuthParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithTimeout adds the timeout to the options leases auth params -func (o *OptionsLeasesAuthParams) WithTimeout(timeout time.Duration) *OptionsLeasesAuthParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the options leases auth params -func (o *OptionsLeasesAuthParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the options leases auth params -func (o *OptionsLeasesAuthParams) WithContext(ctx context.Context) *OptionsLeasesAuthParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the options leases auth params -func (o *OptionsLeasesAuthParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the options leases auth params -func (o *OptionsLeasesAuthParams) WithHTTPClient(client *http.Client) *OptionsLeasesAuthParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the options leases auth params -func (o *OptionsLeasesAuthParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *OptionsLeasesAuthParams) 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/client/c_o_r_s/options_leases_auth_responses.go b/client/c_o_r_s/options_leases_auth_responses.go deleted file mode 100644 index 22b6561..0000000 --- a/client/c_o_r_s/options_leases_auth_responses.go +++ /dev/null @@ -1,69 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package c_o_r_s - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - - "github.com/go-openapi/runtime" - - strfmt "github.com/go-openapi/strfmt" -) - -// OptionsLeasesAuthReader is a Reader for the OptionsLeasesAuth structure. -type OptionsLeasesAuthReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *OptionsLeasesAuthReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewOptionsLeasesAuthOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) - } -} - -// NewOptionsLeasesAuthOK creates a OptionsLeasesAuthOK with default headers values -func NewOptionsLeasesAuthOK() *OptionsLeasesAuthOK { - return &OptionsLeasesAuthOK{} -} - -/*OptionsLeasesAuthOK handles this case with default header values. - -Default response for CORS method -*/ -type OptionsLeasesAuthOK struct { - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string -} - -func (o *OptionsLeasesAuthOK) Error() string { - return fmt.Sprintf("[OPTIONS /leases/auth][%d] optionsLeasesAuthOK ", 200) -} - -func (o *OptionsLeasesAuthOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") - - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") - - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") - - return nil -} diff --git a/client/c_o_r_s/options_leases_id_auth_parameters.go b/client/c_o_r_s/options_leases_id_auth_parameters.go index 4d3bf45..d9bfc0e 100644 --- a/client/c_o_r_s/options_leases_id_auth_parameters.go +++ b/client/c_o_r_s/options_leases_id_auth_parameters.go @@ -13,51 +13,51 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewOptionsLeasesIDAuthParams creates a new OptionsLeasesIDAuthParams object -// with the default values initialized. +// NewOptionsLeasesIDAuthParams creates a new OptionsLeasesIDAuthParams 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 NewOptionsLeasesIDAuthParams() *OptionsLeasesIDAuthParams { - return &OptionsLeasesIDAuthParams{ - timeout: cr.DefaultTimeout, } } // NewOptionsLeasesIDAuthParamsWithTimeout creates a new OptionsLeasesIDAuthParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewOptionsLeasesIDAuthParamsWithTimeout(timeout time.Duration) *OptionsLeasesIDAuthParams { - return &OptionsLeasesIDAuthParams{ - timeout: timeout, } } // NewOptionsLeasesIDAuthParamsWithContext creates a new OptionsLeasesIDAuthParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewOptionsLeasesIDAuthParamsWithContext(ctx context.Context) *OptionsLeasesIDAuthParams { - return &OptionsLeasesIDAuthParams{ - Context: ctx, } } // NewOptionsLeasesIDAuthParamsWithHTTPClient creates a new OptionsLeasesIDAuthParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewOptionsLeasesIDAuthParamsWithHTTPClient(client *http.Client) *OptionsLeasesIDAuthParams { - return &OptionsLeasesIDAuthParams{ HTTPClient: client, } } -/*OptionsLeasesIDAuthParams contains all the parameters to send to the API endpoint -for the options leases ID auth operation typically these are written to a http.Request +/* +OptionsLeasesIDAuthParams contains all the parameters to send to the API endpoint + + for the options leases ID auth operation. + + Typically these are written to a http.Request. */ type OptionsLeasesIDAuthParams struct { timeout time.Duration @@ -65,6 +65,21 @@ type OptionsLeasesIDAuthParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the options leases ID auth params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *OptionsLeasesIDAuthParams) WithDefaults() *OptionsLeasesIDAuthParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the options leases ID auth params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *OptionsLeasesIDAuthParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the options leases ID auth params func (o *OptionsLeasesIDAuthParams) WithTimeout(timeout time.Duration) *OptionsLeasesIDAuthParams { o.SetTimeout(timeout) diff --git a/client/c_o_r_s/options_leases_id_auth_responses.go b/client/c_o_r_s/options_leases_id_auth_responses.go index d361070..b293038 100644 --- a/client/c_o_r_s/options_leases_id_auth_responses.go +++ b/client/c_o_r_s/options_leases_id_auth_responses.go @@ -9,8 +9,7 @@ import ( "fmt" "github.com/go-openapi/runtime" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) // OptionsLeasesIDAuthReader is a Reader for the OptionsLeasesIDAuth structure. @@ -27,9 +26,8 @@ func (o *OptionsLeasesIDAuthReader) ReadResponse(response runtime.ClientResponse return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[OPTIONS /leases/{id}/auth] OptionsLeasesIDAuth", response, response.Code()) } } @@ -38,32 +36,77 @@ func NewOptionsLeasesIDAuthOK() *OptionsLeasesIDAuthOK { return &OptionsLeasesIDAuthOK{} } -/*OptionsLeasesIDAuthOK handles this case with default header values. +/* +OptionsLeasesIDAuthOK describes a response with status code 200, with default header values. Default response for CORS method */ type OptionsLeasesIDAuthOK struct { AccessControlAllowHeaders string - AccessControlAllowMethods string + AccessControlAllowOrigin string +} + +// IsSuccess returns true when this options leases Id auth o k response has a 2xx status code +func (o *OptionsLeasesIDAuthOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this options leases Id auth o k response has a 3xx status code +func (o *OptionsLeasesIDAuthOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this options leases Id auth o k response has a 4xx status code +func (o *OptionsLeasesIDAuthOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this options leases Id auth o k response has a 5xx status code +func (o *OptionsLeasesIDAuthOK) IsServerError() bool { + return false +} + +// IsCode returns true when this options leases Id auth o k response a status code equal to that given +func (o *OptionsLeasesIDAuthOK) IsCode(code int) bool { + return code == 200 +} - AccessControlAllowOrigin string +// Code gets the status code for the options leases Id auth o k response +func (o *OptionsLeasesIDAuthOK) Code() int { + return 200 } func (o *OptionsLeasesIDAuthOK) Error() string { - return fmt.Sprintf("[OPTIONS /leases/{id}/auth][%d] optionsLeasesIdAuthOK ", 200) + return fmt.Sprintf("[OPTIONS /leases/{id}/auth][%d] optionsLeasesIdAuthOK", 200) +} + +func (o *OptionsLeasesIDAuthOK) String() string { + return fmt.Sprintf("[OPTIONS /leases/{id}/auth][%d] optionsLeasesIdAuthOK", 200) } func (o *OptionsLeasesIDAuthOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") + + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } + + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } return nil } diff --git a/client/c_o_r_s/options_leases_id_parameters.go b/client/c_o_r_s/options_leases_id_parameters.go index 3a29eb1..e7779fe 100644 --- a/client/c_o_r_s/options_leases_id_parameters.go +++ b/client/c_o_r_s/options_leases_id_parameters.go @@ -13,51 +13,51 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewOptionsLeasesIDParams creates a new OptionsLeasesIDParams object -// with the default values initialized. +// NewOptionsLeasesIDParams creates a new OptionsLeasesIDParams 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 NewOptionsLeasesIDParams() *OptionsLeasesIDParams { - return &OptionsLeasesIDParams{ - timeout: cr.DefaultTimeout, } } // NewOptionsLeasesIDParamsWithTimeout creates a new OptionsLeasesIDParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewOptionsLeasesIDParamsWithTimeout(timeout time.Duration) *OptionsLeasesIDParams { - return &OptionsLeasesIDParams{ - timeout: timeout, } } // NewOptionsLeasesIDParamsWithContext creates a new OptionsLeasesIDParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewOptionsLeasesIDParamsWithContext(ctx context.Context) *OptionsLeasesIDParams { - return &OptionsLeasesIDParams{ - Context: ctx, } } // NewOptionsLeasesIDParamsWithHTTPClient creates a new OptionsLeasesIDParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewOptionsLeasesIDParamsWithHTTPClient(client *http.Client) *OptionsLeasesIDParams { - return &OptionsLeasesIDParams{ HTTPClient: client, } } -/*OptionsLeasesIDParams contains all the parameters to send to the API endpoint -for the options leases ID operation typically these are written to a http.Request +/* +OptionsLeasesIDParams contains all the parameters to send to the API endpoint + + for the options leases ID operation. + + Typically these are written to a http.Request. */ type OptionsLeasesIDParams struct { timeout time.Duration @@ -65,6 +65,21 @@ type OptionsLeasesIDParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the options leases ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *OptionsLeasesIDParams) WithDefaults() *OptionsLeasesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the options leases ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *OptionsLeasesIDParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the options leases ID params func (o *OptionsLeasesIDParams) WithTimeout(timeout time.Duration) *OptionsLeasesIDParams { o.SetTimeout(timeout) diff --git a/client/c_o_r_s/options_leases_id_responses.go b/client/c_o_r_s/options_leases_id_responses.go index b2de64b..6cbe942 100644 --- a/client/c_o_r_s/options_leases_id_responses.go +++ b/client/c_o_r_s/options_leases_id_responses.go @@ -9,8 +9,7 @@ import ( "fmt" "github.com/go-openapi/runtime" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) // OptionsLeasesIDReader is a Reader for the OptionsLeasesID structure. @@ -27,9 +26,8 @@ func (o *OptionsLeasesIDReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[OPTIONS /leases/{id}] OptionsLeasesID", response, response.Code()) } } @@ -38,32 +36,77 @@ func NewOptionsLeasesIDOK() *OptionsLeasesIDOK { return &OptionsLeasesIDOK{} } -/*OptionsLeasesIDOK handles this case with default header values. +/* +OptionsLeasesIDOK describes a response with status code 200, with default header values. Default response for CORS method */ type OptionsLeasesIDOK struct { AccessControlAllowHeaders string - AccessControlAllowMethods string + AccessControlAllowOrigin string +} + +// IsSuccess returns true when this options leases Id o k response has a 2xx status code +func (o *OptionsLeasesIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this options leases Id o k response has a 3xx status code +func (o *OptionsLeasesIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this options leases Id o k response has a 4xx status code +func (o *OptionsLeasesIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this options leases Id o k response has a 5xx status code +func (o *OptionsLeasesIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this options leases Id o k response a status code equal to that given +func (o *OptionsLeasesIDOK) IsCode(code int) bool { + return code == 200 +} - AccessControlAllowOrigin string +// Code gets the status code for the options leases Id o k response +func (o *OptionsLeasesIDOK) Code() int { + return 200 } func (o *OptionsLeasesIDOK) Error() string { - return fmt.Sprintf("[OPTIONS /leases/{id}][%d] optionsLeasesIdOK ", 200) + return fmt.Sprintf("[OPTIONS /leases/{id}][%d] optionsLeasesIdOK", 200) +} + +func (o *OptionsLeasesIDOK) String() string { + return fmt.Sprintf("[OPTIONS /leases/{id}][%d] optionsLeasesIdOK", 200) } func (o *OptionsLeasesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") + + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } + + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } return nil } diff --git a/client/c_o_r_s/options_leases_parameters.go b/client/c_o_r_s/options_leases_parameters.go index 6e89e7e..93f7934 100644 --- a/client/c_o_r_s/options_leases_parameters.go +++ b/client/c_o_r_s/options_leases_parameters.go @@ -13,51 +13,51 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewOptionsLeasesParams creates a new OptionsLeasesParams object -// with the default values initialized. +// NewOptionsLeasesParams creates a new OptionsLeasesParams 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 NewOptionsLeasesParams() *OptionsLeasesParams { - return &OptionsLeasesParams{ - timeout: cr.DefaultTimeout, } } // NewOptionsLeasesParamsWithTimeout creates a new OptionsLeasesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewOptionsLeasesParamsWithTimeout(timeout time.Duration) *OptionsLeasesParams { - return &OptionsLeasesParams{ - timeout: timeout, } } // NewOptionsLeasesParamsWithContext creates a new OptionsLeasesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewOptionsLeasesParamsWithContext(ctx context.Context) *OptionsLeasesParams { - return &OptionsLeasesParams{ - Context: ctx, } } // NewOptionsLeasesParamsWithHTTPClient creates a new OptionsLeasesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewOptionsLeasesParamsWithHTTPClient(client *http.Client) *OptionsLeasesParams { - return &OptionsLeasesParams{ HTTPClient: client, } } -/*OptionsLeasesParams contains all the parameters to send to the API endpoint -for the options leases operation typically these are written to a http.Request +/* +OptionsLeasesParams contains all the parameters to send to the API endpoint + + for the options leases operation. + + Typically these are written to a http.Request. */ type OptionsLeasesParams struct { timeout time.Duration @@ -65,6 +65,21 @@ type OptionsLeasesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the options leases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *OptionsLeasesParams) WithDefaults() *OptionsLeasesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the options leases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *OptionsLeasesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the options leases params func (o *OptionsLeasesParams) WithTimeout(timeout time.Duration) *OptionsLeasesParams { o.SetTimeout(timeout) diff --git a/client/c_o_r_s/options_leases_responses.go b/client/c_o_r_s/options_leases_responses.go index ad95551..8ec0d7a 100644 --- a/client/c_o_r_s/options_leases_responses.go +++ b/client/c_o_r_s/options_leases_responses.go @@ -9,8 +9,7 @@ import ( "fmt" "github.com/go-openapi/runtime" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) // OptionsLeasesReader is a Reader for the OptionsLeases structure. @@ -27,9 +26,8 @@ func (o *OptionsLeasesReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[OPTIONS /leases] OptionsLeases", response, response.Code()) } } @@ -38,32 +36,77 @@ func NewOptionsLeasesOK() *OptionsLeasesOK { return &OptionsLeasesOK{} } -/*OptionsLeasesOK handles this case with default header values. +/* +OptionsLeasesOK describes a response with status code 200, with default header values. Default response for CORS method */ type OptionsLeasesOK struct { AccessControlAllowHeaders string - AccessControlAllowMethods string + AccessControlAllowOrigin string +} + +// IsSuccess returns true when this options leases o k response has a 2xx status code +func (o *OptionsLeasesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this options leases o k response has a 3xx status code +func (o *OptionsLeasesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this options leases o k response has a 4xx status code +func (o *OptionsLeasesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this options leases o k response has a 5xx status code +func (o *OptionsLeasesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this options leases o k response a status code equal to that given +func (o *OptionsLeasesOK) IsCode(code int) bool { + return code == 200 +} - AccessControlAllowOrigin string +// Code gets the status code for the options leases o k response +func (o *OptionsLeasesOK) Code() int { + return 200 } func (o *OptionsLeasesOK) Error() string { - return fmt.Sprintf("[OPTIONS /leases][%d] optionsLeasesOK ", 200) + return fmt.Sprintf("[OPTIONS /leases][%d] optionsLeasesOK", 200) +} + +func (o *OptionsLeasesOK) String() string { + return fmt.Sprintf("[OPTIONS /leases][%d] optionsLeasesOK", 200) } func (o *OptionsLeasesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") + + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } + + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } return nil } diff --git a/client/c_o_r_s/options_usage_parameters.go b/client/c_o_r_s/options_usage_parameters.go index 1883e4f..78526b5 100644 --- a/client/c_o_r_s/options_usage_parameters.go +++ b/client/c_o_r_s/options_usage_parameters.go @@ -13,51 +13,51 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewOptionsUsageParams creates a new OptionsUsageParams object -// with the default values initialized. +// NewOptionsUsageParams creates a new OptionsUsageParams 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 NewOptionsUsageParams() *OptionsUsageParams { - return &OptionsUsageParams{ - timeout: cr.DefaultTimeout, } } // NewOptionsUsageParamsWithTimeout creates a new OptionsUsageParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewOptionsUsageParamsWithTimeout(timeout time.Duration) *OptionsUsageParams { - return &OptionsUsageParams{ - timeout: timeout, } } // NewOptionsUsageParamsWithContext creates a new OptionsUsageParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewOptionsUsageParamsWithContext(ctx context.Context) *OptionsUsageParams { - return &OptionsUsageParams{ - Context: ctx, } } // NewOptionsUsageParamsWithHTTPClient creates a new OptionsUsageParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewOptionsUsageParamsWithHTTPClient(client *http.Client) *OptionsUsageParams { - return &OptionsUsageParams{ HTTPClient: client, } } -/*OptionsUsageParams contains all the parameters to send to the API endpoint -for the options usage operation typically these are written to a http.Request +/* +OptionsUsageParams contains all the parameters to send to the API endpoint + + for the options usage operation. + + Typically these are written to a http.Request. */ type OptionsUsageParams struct { timeout time.Duration @@ -65,6 +65,21 @@ type OptionsUsageParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the options usage params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *OptionsUsageParams) WithDefaults() *OptionsUsageParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the options usage params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *OptionsUsageParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the options usage params func (o *OptionsUsageParams) WithTimeout(timeout time.Duration) *OptionsUsageParams { o.SetTimeout(timeout) diff --git a/client/c_o_r_s/options_usage_responses.go b/client/c_o_r_s/options_usage_responses.go index 1f7021b..57cd72f 100644 --- a/client/c_o_r_s/options_usage_responses.go +++ b/client/c_o_r_s/options_usage_responses.go @@ -9,8 +9,7 @@ import ( "fmt" "github.com/go-openapi/runtime" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) // OptionsUsageReader is a Reader for the OptionsUsage structure. @@ -27,9 +26,8 @@ func (o *OptionsUsageReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[OPTIONS /usage] OptionsUsage", response, response.Code()) } } @@ -38,32 +36,77 @@ func NewOptionsUsageOK() *OptionsUsageOK { return &OptionsUsageOK{} } -/*OptionsUsageOK handles this case with default header values. +/* +OptionsUsageOK describes a response with status code 200, with default header values. Default response for CORS method */ type OptionsUsageOK struct { AccessControlAllowHeaders string - AccessControlAllowMethods string + AccessControlAllowOrigin string +} + +// IsSuccess returns true when this options usage o k response has a 2xx status code +func (o *OptionsUsageOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this options usage o k response has a 3xx status code +func (o *OptionsUsageOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this options usage o k response has a 4xx status code +func (o *OptionsUsageOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this options usage o k response has a 5xx status code +func (o *OptionsUsageOK) IsServerError() bool { + return false +} + +// IsCode returns true when this options usage o k response a status code equal to that given +func (o *OptionsUsageOK) IsCode(code int) bool { + return code == 200 +} - AccessControlAllowOrigin string +// Code gets the status code for the options usage o k response +func (o *OptionsUsageOK) Code() int { + return 200 } func (o *OptionsUsageOK) Error() string { - return fmt.Sprintf("[OPTIONS /usage][%d] optionsUsageOK ", 200) + return fmt.Sprintf("[OPTIONS /usage][%d] optionsUsageOK", 200) +} + +func (o *OptionsUsageOK) String() string { + return fmt.Sprintf("[OPTIONS /usage][%d] optionsUsageOK", 200) } func (o *OptionsUsageOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") + + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } + + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } return nil } diff --git a/client/dollar_namespace_client.go b/client/dollar_namespace_client.go index f76ad4b..3381d4c 100644 --- a/client/dollar_namespace_client.go +++ b/client/dollar_namespace_client.go @@ -6,9 +6,8 @@ package client // Editing this file might prove futile when you re-run the swagger generate command import ( - httptransport "github.com/go-openapi/runtime/client" - "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" "github.com/Optum/dce-cli/client/c_o_r_s" diff --git a/client/operations/delete_accounts_id_parameters.go b/client/operations/delete_accounts_id_parameters.go index 6e7cdcd..8f8c0a6 100644 --- a/client/operations/delete_accounts_id_parameters.go +++ b/client/operations/delete_accounts_id_parameters.go @@ -13,57 +13,57 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewDeleteAccountsIDParams creates a new DeleteAccountsIDParams object -// with the default values initialized. +// NewDeleteAccountsIDParams creates a new DeleteAccountsIDParams 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 NewDeleteAccountsIDParams() *DeleteAccountsIDParams { - var () return &DeleteAccountsIDParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteAccountsIDParamsWithTimeout creates a new DeleteAccountsIDParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteAccountsIDParamsWithTimeout(timeout time.Duration) *DeleteAccountsIDParams { - var () return &DeleteAccountsIDParams{ - timeout: timeout, } } // NewDeleteAccountsIDParamsWithContext creates a new DeleteAccountsIDParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteAccountsIDParamsWithContext(ctx context.Context) *DeleteAccountsIDParams { - var () return &DeleteAccountsIDParams{ - Context: ctx, } } // NewDeleteAccountsIDParamsWithHTTPClient creates a new DeleteAccountsIDParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteAccountsIDParamsWithHTTPClient(client *http.Client) *DeleteAccountsIDParams { - var () return &DeleteAccountsIDParams{ HTTPClient: client, } } -/*DeleteAccountsIDParams contains all the parameters to send to the API endpoint -for the delete accounts ID operation typically these are written to a http.Request +/* +DeleteAccountsIDParams contains all the parameters to send to the API endpoint + + for the delete accounts ID operation. + + Typically these are written to a http.Request. */ type DeleteAccountsIDParams struct { - /*ID - The ID of the account to be deleted. + /* ID. + The ID of the account to be deleted. */ ID string @@ -72,6 +72,21 @@ type DeleteAccountsIDParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete accounts ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAccountsIDParams) WithDefaults() *DeleteAccountsIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete accounts ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAccountsIDParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete accounts ID params func (o *DeleteAccountsIDParams) WithTimeout(timeout time.Duration) *DeleteAccountsIDParams { o.SetTimeout(timeout) diff --git a/client/operations/delete_accounts_id_responses.go b/client/operations/delete_accounts_id_responses.go index 0ccba40..99147b3 100644 --- a/client/operations/delete_accounts_id_responses.go +++ b/client/operations/delete_accounts_id_responses.go @@ -9,8 +9,7 @@ import ( "fmt" "github.com/go-openapi/runtime" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) // DeleteAccountsIDReader is a Reader for the DeleteAccountsID structure. @@ -45,9 +44,8 @@ func (o *DeleteAccountsIDReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[DELETE /accounts/{id}] DeleteAccountsID", response, response.Code()) } } @@ -56,32 +54,77 @@ func NewDeleteAccountsIDNoContent() *DeleteAccountsIDNoContent { return &DeleteAccountsIDNoContent{} } -/*DeleteAccountsIDNoContent handles this case with default header values. +/* +DeleteAccountsIDNoContent describes a response with status code 204, with default header values. The account has been successfully deleted. */ type DeleteAccountsIDNoContent struct { AccessControlAllowHeaders string - AccessControlAllowMethods string + AccessControlAllowOrigin string +} + +// IsSuccess returns true when this delete accounts Id no content response has a 2xx status code +func (o *DeleteAccountsIDNoContent) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete accounts Id no content response has a 3xx status code +func (o *DeleteAccountsIDNoContent) IsRedirect() bool { + return false +} - AccessControlAllowOrigin string +// IsClientError returns true when this delete accounts Id no content response has a 4xx status code +func (o *DeleteAccountsIDNoContent) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete accounts Id no content response has a 5xx status code +func (o *DeleteAccountsIDNoContent) IsServerError() bool { + return false +} + +// IsCode returns true when this delete accounts Id no content response a status code equal to that given +func (o *DeleteAccountsIDNoContent) IsCode(code int) bool { + return code == 204 +} + +// Code gets the status code for the delete accounts Id no content response +func (o *DeleteAccountsIDNoContent) Code() int { + return 204 } func (o *DeleteAccountsIDNoContent) Error() string { - return fmt.Sprintf("[DELETE /accounts/{id}][%d] deleteAccountsIdNoContent ", 204) + return fmt.Sprintf("[DELETE /accounts/{id}][%d] deleteAccountsIdNoContent", 204) +} + +func (o *DeleteAccountsIDNoContent) String() string { + return fmt.Sprintf("[DELETE /accounts/{id}][%d] deleteAccountsIdNoContent", 204) } func (o *DeleteAccountsIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } + + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") + + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } return nil } @@ -91,15 +134,50 @@ func NewDeleteAccountsIDForbidden() *DeleteAccountsIDForbidden { return &DeleteAccountsIDForbidden{} } -/*DeleteAccountsIDForbidden handles this case with default header values. +/* +DeleteAccountsIDForbidden describes a response with status code 403, with default header values. Unauthorized. */ type DeleteAccountsIDForbidden struct { } +// IsSuccess returns true when this delete accounts Id forbidden response has a 2xx status code +func (o *DeleteAccountsIDForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this delete accounts Id forbidden response has a 3xx status code +func (o *DeleteAccountsIDForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete accounts Id forbidden response has a 4xx status code +func (o *DeleteAccountsIDForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this delete accounts Id forbidden response has a 5xx status code +func (o *DeleteAccountsIDForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this delete accounts Id forbidden response a status code equal to that given +func (o *DeleteAccountsIDForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the delete accounts Id forbidden response +func (o *DeleteAccountsIDForbidden) Code() int { + return 403 +} + func (o *DeleteAccountsIDForbidden) Error() string { - return fmt.Sprintf("[DELETE /accounts/{id}][%d] deleteAccountsIdForbidden ", 403) + return fmt.Sprintf("[DELETE /accounts/{id}][%d] deleteAccountsIdForbidden", 403) +} + +func (o *DeleteAccountsIDForbidden) String() string { + return fmt.Sprintf("[DELETE /accounts/{id}][%d] deleteAccountsIdForbidden", 403) } func (o *DeleteAccountsIDForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -112,15 +190,50 @@ func NewDeleteAccountsIDNotFound() *DeleteAccountsIDNotFound { return &DeleteAccountsIDNotFound{} } -/*DeleteAccountsIDNotFound handles this case with default header values. +/* +DeleteAccountsIDNotFound describes a response with status code 404, with default header values. No account found for the given ID. */ type DeleteAccountsIDNotFound struct { } +// IsSuccess returns true when this delete accounts Id not found response has a 2xx status code +func (o *DeleteAccountsIDNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this delete accounts Id not found response has a 3xx status code +func (o *DeleteAccountsIDNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete accounts Id not found response has a 4xx status code +func (o *DeleteAccountsIDNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this delete accounts Id not found response has a 5xx status code +func (o *DeleteAccountsIDNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this delete accounts Id not found response a status code equal to that given +func (o *DeleteAccountsIDNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the delete accounts Id not found response +func (o *DeleteAccountsIDNotFound) Code() int { + return 404 +} + func (o *DeleteAccountsIDNotFound) Error() string { - return fmt.Sprintf("[DELETE /accounts/{id}][%d] deleteAccountsIdNotFound ", 404) + return fmt.Sprintf("[DELETE /accounts/{id}][%d] deleteAccountsIdNotFound", 404) +} + +func (o *DeleteAccountsIDNotFound) String() string { + return fmt.Sprintf("[DELETE /accounts/{id}][%d] deleteAccountsIdNotFound", 404) } func (o *DeleteAccountsIDNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -133,15 +246,50 @@ func NewDeleteAccountsIDConflict() *DeleteAccountsIDConflict { return &DeleteAccountsIDConflict{} } -/*DeleteAccountsIDConflict handles this case with default header values. +/* +DeleteAccountsIDConflict describes a response with status code 409, with default header values. The account is unable to be deleted. */ type DeleteAccountsIDConflict struct { } +// IsSuccess returns true when this delete accounts Id conflict response has a 2xx status code +func (o *DeleteAccountsIDConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this delete accounts Id conflict response has a 3xx status code +func (o *DeleteAccountsIDConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete accounts Id conflict response has a 4xx status code +func (o *DeleteAccountsIDConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this delete accounts Id conflict response has a 5xx status code +func (o *DeleteAccountsIDConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this delete accounts Id conflict response a status code equal to that given +func (o *DeleteAccountsIDConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the delete accounts Id conflict response +func (o *DeleteAccountsIDConflict) Code() int { + return 409 +} + func (o *DeleteAccountsIDConflict) Error() string { - return fmt.Sprintf("[DELETE /accounts/{id}][%d] deleteAccountsIdConflict ", 409) + return fmt.Sprintf("[DELETE /accounts/{id}][%d] deleteAccountsIdConflict", 409) +} + +func (o *DeleteAccountsIDConflict) String() string { + return fmt.Sprintf("[DELETE /accounts/{id}][%d] deleteAccountsIdConflict", 409) } func (o *DeleteAccountsIDConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/client/operations/delete_leases_id_parameters.go b/client/operations/delete_leases_id_parameters.go index 77d613a..854aa93 100644 --- a/client/operations/delete_leases_id_parameters.go +++ b/client/operations/delete_leases_id_parameters.go @@ -13,57 +13,57 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewDeleteLeasesIDParams creates a new DeleteLeasesIDParams object -// with the default values initialized. +// NewDeleteLeasesIDParams creates a new DeleteLeasesIDParams 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 NewDeleteLeasesIDParams() *DeleteLeasesIDParams { - var () return &DeleteLeasesIDParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteLeasesIDParamsWithTimeout creates a new DeleteLeasesIDParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteLeasesIDParamsWithTimeout(timeout time.Duration) *DeleteLeasesIDParams { - var () return &DeleteLeasesIDParams{ - timeout: timeout, } } // NewDeleteLeasesIDParamsWithContext creates a new DeleteLeasesIDParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteLeasesIDParamsWithContext(ctx context.Context) *DeleteLeasesIDParams { - var () return &DeleteLeasesIDParams{ - Context: ctx, } } // NewDeleteLeasesIDParamsWithHTTPClient creates a new DeleteLeasesIDParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteLeasesIDParamsWithHTTPClient(client *http.Client) *DeleteLeasesIDParams { - var () return &DeleteLeasesIDParams{ HTTPClient: client, } } -/*DeleteLeasesIDParams contains all the parameters to send to the API endpoint -for the delete leases ID operation typically these are written to a http.Request +/* +DeleteLeasesIDParams contains all the parameters to send to the API endpoint + + for the delete leases ID operation. + + Typically these are written to a http.Request. */ type DeleteLeasesIDParams struct { - /*ID - The ID of the lease to be deleted. + /* ID. + The ID of the lease to be deleted. */ ID string @@ -72,6 +72,21 @@ type DeleteLeasesIDParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete leases ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteLeasesIDParams) WithDefaults() *DeleteLeasesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete leases ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteLeasesIDParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete leases ID params func (o *DeleteLeasesIDParams) WithTimeout(timeout time.Duration) *DeleteLeasesIDParams { o.SetTimeout(timeout) diff --git a/client/operations/delete_leases_id_responses.go b/client/operations/delete_leases_id_responses.go index 2a165a6..1d30159 100644 --- a/client/operations/delete_leases_id_responses.go +++ b/client/operations/delete_leases_id_responses.go @@ -6,16 +6,16 @@ package operations // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "fmt" "io" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - strfmt "github.com/go-openapi/strfmt" ) // DeleteLeasesIDReader is a Reader for the DeleteLeasesID structure. @@ -50,9 +50,8 @@ func (o *DeleteLeasesIDReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[DELETE /leases/{id}] DeleteLeasesID", response, response.Code()) } } @@ -61,7 +60,8 @@ func NewDeleteLeasesIDOK() *DeleteLeasesIDOK { return &DeleteLeasesIDOK{} } -/*DeleteLeasesIDOK handles this case with default header values. +/* +DeleteLeasesIDOK describes a response with status code 200, with default header values. DeleteLeasesIDOK delete leases Id o k */ @@ -69,11 +69,44 @@ type DeleteLeasesIDOK struct { Payload *DeleteLeasesIDOKBody } +// IsSuccess returns true when this delete leases Id o k response has a 2xx status code +func (o *DeleteLeasesIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete leases Id o k response has a 3xx status code +func (o *DeleteLeasesIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete leases Id o k response has a 4xx status code +func (o *DeleteLeasesIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete leases Id o k response has a 5xx status code +func (o *DeleteLeasesIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this delete leases Id o k response a status code equal to that given +func (o *DeleteLeasesIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the delete leases Id o k response +func (o *DeleteLeasesIDOK) Code() int { + return 200 +} + func (o *DeleteLeasesIDOK) Error() string { - /* - #nosec CWE-89: false positive. No sql here. - */ - return fmt.Sprintf("[DELETE /leases/{id}][%d] deleteLeasesIdOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /leases/{id}][%d] deleteLeasesIdOK %s", 200, payload) +} + +func (o *DeleteLeasesIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /leases/{id}][%d] deleteLeasesIdOK %s", 200, payload) } func (o *DeleteLeasesIDOK) GetPayload() *DeleteLeasesIDOKBody { @@ -97,16 +130,50 @@ func NewDeleteLeasesIDBadRequest() *DeleteLeasesIDBadRequest { return &DeleteLeasesIDBadRequest{} } -/*DeleteLeasesIDBadRequest handles this case with default header values. +/* +DeleteLeasesIDBadRequest describes a response with status code 400, with default header values. "Failed to Parse Request Body" if the request body is blank or incorrectly formatted. or if there are no account leases found for the specified accountId or if the account specified is not already Active. - */ type DeleteLeasesIDBadRequest struct { } +// IsSuccess returns true when this delete leases Id bad request response has a 2xx status code +func (o *DeleteLeasesIDBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this delete leases Id bad request response has a 3xx status code +func (o *DeleteLeasesIDBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete leases Id bad request response has a 4xx status code +func (o *DeleteLeasesIDBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this delete leases Id bad request response has a 5xx status code +func (o *DeleteLeasesIDBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this delete leases Id bad request response a status code equal to that given +func (o *DeleteLeasesIDBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the delete leases Id bad request response +func (o *DeleteLeasesIDBadRequest) Code() int { + return 400 +} + func (o *DeleteLeasesIDBadRequest) Error() string { - return fmt.Sprintf("[DELETE /leases/{id}][%d] deleteLeasesIdBadRequest ", 400) + return fmt.Sprintf("[DELETE /leases/{id}][%d] deleteLeasesIdBadRequest", 400) +} + +func (o *DeleteLeasesIDBadRequest) String() string { + return fmt.Sprintf("[DELETE /leases/{id}][%d] deleteLeasesIdBadRequest", 400) } func (o *DeleteLeasesIDBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -119,15 +186,50 @@ func NewDeleteLeasesIDForbidden() *DeleteLeasesIDForbidden { return &DeleteLeasesIDForbidden{} } -/*DeleteLeasesIDForbidden handles this case with default header values. +/* +DeleteLeasesIDForbidden describes a response with status code 403, with default header values. Failed to authenticate request */ type DeleteLeasesIDForbidden struct { } +// IsSuccess returns true when this delete leases Id forbidden response has a 2xx status code +func (o *DeleteLeasesIDForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this delete leases Id forbidden response has a 3xx status code +func (o *DeleteLeasesIDForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete leases Id forbidden response has a 4xx status code +func (o *DeleteLeasesIDForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this delete leases Id forbidden response has a 5xx status code +func (o *DeleteLeasesIDForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this delete leases Id forbidden response a status code equal to that given +func (o *DeleteLeasesIDForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the delete leases Id forbidden response +func (o *DeleteLeasesIDForbidden) Code() int { + return 403 +} + func (o *DeleteLeasesIDForbidden) Error() string { - return fmt.Sprintf("[DELETE /leases/{id}][%d] deleteLeasesIdForbidden ", 403) + return fmt.Sprintf("[DELETE /leases/{id}][%d] deleteLeasesIdForbidden", 403) +} + +func (o *DeleteLeasesIDForbidden) String() string { + return fmt.Sprintf("[DELETE /leases/{id}][%d] deleteLeasesIdForbidden", 403) } func (o *DeleteLeasesIDForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -140,15 +242,50 @@ func NewDeleteLeasesIDInternalServerError() *DeleteLeasesIDInternalServerError { return &DeleteLeasesIDInternalServerError{} } -/*DeleteLeasesIDInternalServerError handles this case with default header values. +/* +DeleteLeasesIDInternalServerError describes a response with status code 500, with default header values. Server errors if the database cannot be reached. */ type DeleteLeasesIDInternalServerError struct { } +// IsSuccess returns true when this delete leases Id internal server error response has a 2xx status code +func (o *DeleteLeasesIDInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this delete leases Id internal server error response has a 3xx status code +func (o *DeleteLeasesIDInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete leases Id internal server error response has a 4xx status code +func (o *DeleteLeasesIDInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete leases Id internal server error response has a 5xx status code +func (o *DeleteLeasesIDInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this delete leases Id internal server error response a status code equal to that given +func (o *DeleteLeasesIDInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the delete leases Id internal server error response +func (o *DeleteLeasesIDInternalServerError) Code() int { + return 500 +} + func (o *DeleteLeasesIDInternalServerError) Error() string { - return fmt.Sprintf("[DELETE /leases/{id}][%d] deleteLeasesIdInternalServerError ", 500) + return fmt.Sprintf("[DELETE /leases/{id}][%d] deleteLeasesIdInternalServerError", 500) +} + +func (o *DeleteLeasesIDInternalServerError) String() string { + return fmt.Sprintf("[DELETE /leases/{id}][%d] deleteLeasesIdInternalServerError", 500) } func (o *DeleteLeasesIDInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -156,7 +293,8 @@ func (o *DeleteLeasesIDInternalServerError) readResponse(response runtime.Client return nil } -/*DeleteLeasesIDOKBody Lease Details +/* +DeleteLeasesIDOKBody Lease Details swagger:model DeleteLeasesIDOKBody */ type DeleteLeasesIDOKBody struct { @@ -189,7 +327,7 @@ type DeleteLeasesIDOKBody struct { // "Active": The principal is leased and has access to the account // "Inactive": The lease has become inactive, either through expiring, exceeding budget, or by request. // - // Enum: [Active Inactive] + // Enum: ["Active","Inactive"] LeaseStatus string `json:"leaseStatus,omitempty"` // date lease status was last modified in epoch seconds @@ -206,7 +344,7 @@ type DeleteLeasesIDOKBody struct { // "LeaseRolledBack": A system error occurred while provisioning the lease. // and it was rolled back. // - // Enum: [LeaseExpired LeaseOverBudget LeaseDestroyed LeaseActive LeaseRolledBack] + // Enum: ["LeaseExpired","LeaseOverBudget","LeaseDestroyed","LeaseActive","LeaseRolledBack"] LeaseStatusReason string `json:"leaseStatusReason,omitempty"` // principalId of the lease to get @@ -254,14 +392,13 @@ const ( // prop value enum func (o *DeleteLeasesIDOKBody) validateLeaseStatusEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, deleteLeasesIdOKBodyTypeLeaseStatusPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, deleteLeasesIdOKBodyTypeLeaseStatusPropEnum, true); err != nil { return err } return nil } func (o *DeleteLeasesIDOKBody) validateLeaseStatus(formats strfmt.Registry) error { - if swag.IsZero(o.LeaseStatus) { // not required return nil } @@ -306,14 +443,13 @@ const ( // prop value enum func (o *DeleteLeasesIDOKBody) validateLeaseStatusReasonEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, deleteLeasesIdOKBodyTypeLeaseStatusReasonPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, deleteLeasesIdOKBodyTypeLeaseStatusReasonPropEnum, true); err != nil { return err } return nil } func (o *DeleteLeasesIDOKBody) validateLeaseStatusReason(formats strfmt.Registry) error { - if swag.IsZero(o.LeaseStatusReason) { // not required return nil } @@ -326,6 +462,11 @@ func (o *DeleteLeasesIDOKBody) validateLeaseStatusReason(formats strfmt.Registry return nil } +// ContextValidate validates this delete leases ID o k body based on context it is used +func (o *DeleteLeasesIDOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *DeleteLeasesIDOKBody) MarshalBinary() ([]byte, error) { if o == nil { diff --git a/client/operations/delete_leases_parameters.go b/client/operations/delete_leases_parameters.go index 33fb9fc..b168f38 100644 --- a/client/operations/delete_leases_parameters.go +++ b/client/operations/delete_leases_parameters.go @@ -13,57 +13,57 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewDeleteLeasesParams creates a new DeleteLeasesParams object -// with the default values initialized. +// NewDeleteLeasesParams creates a new DeleteLeasesParams 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 NewDeleteLeasesParams() *DeleteLeasesParams { - var () return &DeleteLeasesParams{ - timeout: cr.DefaultTimeout, } } // NewDeleteLeasesParamsWithTimeout creates a new DeleteLeasesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDeleteLeasesParamsWithTimeout(timeout time.Duration) *DeleteLeasesParams { - var () return &DeleteLeasesParams{ - timeout: timeout, } } // NewDeleteLeasesParamsWithContext creates a new DeleteLeasesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDeleteLeasesParamsWithContext(ctx context.Context) *DeleteLeasesParams { - var () return &DeleteLeasesParams{ - Context: ctx, } } // NewDeleteLeasesParamsWithHTTPClient creates a new DeleteLeasesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDeleteLeasesParamsWithHTTPClient(client *http.Client) *DeleteLeasesParams { - var () return &DeleteLeasesParams{ HTTPClient: client, } } -/*DeleteLeasesParams contains all the parameters to send to the API endpoint -for the delete leases operation typically these are written to a http.Request +/* +DeleteLeasesParams contains all the parameters to send to the API endpoint + + for the delete leases operation. + + Typically these are written to a http.Request. */ type DeleteLeasesParams struct { - /*Lease - The owner of the lease + /* Lease. + The owner of the lease */ Lease DeleteLeasesBody @@ -72,6 +72,21 @@ type DeleteLeasesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the delete leases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteLeasesParams) WithDefaults() *DeleteLeasesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete leases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteLeasesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the delete leases params func (o *DeleteLeasesParams) WithTimeout(timeout time.Duration) *DeleteLeasesParams { o.SetTimeout(timeout) @@ -123,7 +138,6 @@ func (o *DeleteLeasesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if err := r.SetBodyParam(o.Lease); err != nil { return err } diff --git a/client/operations/delete_leases_responses.go b/client/operations/delete_leases_responses.go index 8afbc35..2fc0214 100644 --- a/client/operations/delete_leases_responses.go +++ b/client/operations/delete_leases_responses.go @@ -6,16 +6,16 @@ package operations // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "fmt" + "io" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - "io" - - strfmt "github.com/go-openapi/strfmt" ) // DeleteLeasesReader is a Reader for the DeleteLeases structure. @@ -50,9 +50,8 @@ func (o *DeleteLeasesReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[DELETE /leases] DeleteLeases", response, response.Code()) } } @@ -61,7 +60,8 @@ func NewDeleteLeasesOK() *DeleteLeasesOK { return &DeleteLeasesOK{} } -/*DeleteLeasesOK handles this case with default header values. +/* +DeleteLeasesOK describes a response with status code 200, with default header values. DeleteLeasesOK delete leases o k */ @@ -69,11 +69,44 @@ type DeleteLeasesOK struct { Payload *DeleteLeasesOKBody } +// IsSuccess returns true when this delete leases o k response has a 2xx status code +func (o *DeleteLeasesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete leases o k response has a 3xx status code +func (o *DeleteLeasesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete leases o k response has a 4xx status code +func (o *DeleteLeasesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete leases o k response has a 5xx status code +func (o *DeleteLeasesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this delete leases o k response a status code equal to that given +func (o *DeleteLeasesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the delete leases o k response +func (o *DeleteLeasesOK) Code() int { + return 200 +} + func (o *DeleteLeasesOK) Error() string { - /* - #nosec CWE-89: false positive. No sql here. - */ - return fmt.Sprintf("[DELETE /leases][%d] deleteLeasesOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /leases][%d] deleteLeasesOK %s", 200, payload) +} + +func (o *DeleteLeasesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /leases][%d] deleteLeasesOK %s", 200, payload) } func (o *DeleteLeasesOK) GetPayload() *DeleteLeasesOKBody { @@ -97,16 +130,50 @@ func NewDeleteLeasesBadRequest() *DeleteLeasesBadRequest { return &DeleteLeasesBadRequest{} } -/*DeleteLeasesBadRequest handles this case with default header values. +/* +DeleteLeasesBadRequest describes a response with status code 400, with default header values. "Failed to Parse Request Body" if the request body is blank or incorrectly formatted. or if there are no account leases found for the specified accountId or if the account specified is not already Active. - */ type DeleteLeasesBadRequest struct { } +// IsSuccess returns true when this delete leases bad request response has a 2xx status code +func (o *DeleteLeasesBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this delete leases bad request response has a 3xx status code +func (o *DeleteLeasesBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete leases bad request response has a 4xx status code +func (o *DeleteLeasesBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this delete leases bad request response has a 5xx status code +func (o *DeleteLeasesBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this delete leases bad request response a status code equal to that given +func (o *DeleteLeasesBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the delete leases bad request response +func (o *DeleteLeasesBadRequest) Code() int { + return 400 +} + func (o *DeleteLeasesBadRequest) Error() string { - return fmt.Sprintf("[DELETE /leases][%d] deleteLeasesBadRequest ", 400) + return fmt.Sprintf("[DELETE /leases][%d] deleteLeasesBadRequest", 400) +} + +func (o *DeleteLeasesBadRequest) String() string { + return fmt.Sprintf("[DELETE /leases][%d] deleteLeasesBadRequest", 400) } func (o *DeleteLeasesBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -119,15 +186,50 @@ func NewDeleteLeasesForbidden() *DeleteLeasesForbidden { return &DeleteLeasesForbidden{} } -/*DeleteLeasesForbidden handles this case with default header values. +/* +DeleteLeasesForbidden describes a response with status code 403, with default header values. Failed to authenticate request */ type DeleteLeasesForbidden struct { } +// IsSuccess returns true when this delete leases forbidden response has a 2xx status code +func (o *DeleteLeasesForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this delete leases forbidden response has a 3xx status code +func (o *DeleteLeasesForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete leases forbidden response has a 4xx status code +func (o *DeleteLeasesForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this delete leases forbidden response has a 5xx status code +func (o *DeleteLeasesForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this delete leases forbidden response a status code equal to that given +func (o *DeleteLeasesForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the delete leases forbidden response +func (o *DeleteLeasesForbidden) Code() int { + return 403 +} + func (o *DeleteLeasesForbidden) Error() string { - return fmt.Sprintf("[DELETE /leases][%d] deleteLeasesForbidden ", 403) + return fmt.Sprintf("[DELETE /leases][%d] deleteLeasesForbidden", 403) +} + +func (o *DeleteLeasesForbidden) String() string { + return fmt.Sprintf("[DELETE /leases][%d] deleteLeasesForbidden", 403) } func (o *DeleteLeasesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -140,15 +242,50 @@ func NewDeleteLeasesInternalServerError() *DeleteLeasesInternalServerError { return &DeleteLeasesInternalServerError{} } -/*DeleteLeasesInternalServerError handles this case with default header values. +/* +DeleteLeasesInternalServerError describes a response with status code 500, with default header values. Server errors if the database cannot be reached. */ type DeleteLeasesInternalServerError struct { } +// IsSuccess returns true when this delete leases internal server error response has a 2xx status code +func (o *DeleteLeasesInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this delete leases internal server error response has a 3xx status code +func (o *DeleteLeasesInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete leases internal server error response has a 4xx status code +func (o *DeleteLeasesInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete leases internal server error response has a 5xx status code +func (o *DeleteLeasesInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this delete leases internal server error response a status code equal to that given +func (o *DeleteLeasesInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the delete leases internal server error response +func (o *DeleteLeasesInternalServerError) Code() int { + return 500 +} + func (o *DeleteLeasesInternalServerError) Error() string { - return fmt.Sprintf("[DELETE /leases][%d] deleteLeasesInternalServerError ", 500) + return fmt.Sprintf("[DELETE /leases][%d] deleteLeasesInternalServerError", 500) +} + +func (o *DeleteLeasesInternalServerError) String() string { + return fmt.Sprintf("[DELETE /leases][%d] deleteLeasesInternalServerError", 500) } func (o *DeleteLeasesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -156,7 +293,8 @@ func (o *DeleteLeasesInternalServerError) readResponse(response runtime.ClientRe return nil } -/*DeleteLeasesBody delete leases body +/* +DeleteLeasesBody delete leases body swagger:model DeleteLeasesBody */ type DeleteLeasesBody struct { @@ -206,6 +344,11 @@ func (o *DeleteLeasesBody) validatePrincipalID(formats strfmt.Registry) error { return nil } +// ContextValidate validates this delete leases body based on context it is used +func (o *DeleteLeasesBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *DeleteLeasesBody) MarshalBinary() ([]byte, error) { if o == nil { @@ -224,7 +367,8 @@ func (o *DeleteLeasesBody) UnmarshalBinary(b []byte) error { return nil } -/*DeleteLeasesOKBody Lease Details +/* +DeleteLeasesOKBody Lease Details swagger:model DeleteLeasesOKBody */ type DeleteLeasesOKBody struct { @@ -257,7 +401,7 @@ type DeleteLeasesOKBody struct { // "Active": The principal is leased and has access to the account // "Inactive": The lease has become inactive, either through expiring, exceeding budget, or by request. // - // Enum: [Active Inactive] + // Enum: ["Active","Inactive"] LeaseStatus string `json:"leaseStatus,omitempty"` // date lease status was last modified in epoch seconds @@ -274,7 +418,7 @@ type DeleteLeasesOKBody struct { // "LeaseRolledBack": A system error occurred while provisioning the lease. // and it was rolled back. // - // Enum: [LeaseExpired LeaseOverBudget LeaseDestroyed LeaseActive LeaseRolledBack] + // Enum: ["LeaseExpired","LeaseOverBudget","LeaseDestroyed","LeaseActive","LeaseRolledBack"] LeaseStatusReason string `json:"leaseStatusReason,omitempty"` // principalId of the lease to get @@ -322,14 +466,13 @@ const ( // prop value enum func (o *DeleteLeasesOKBody) validateLeaseStatusEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, deleteLeasesOKBodyTypeLeaseStatusPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, deleteLeasesOKBodyTypeLeaseStatusPropEnum, true); err != nil { return err } return nil } func (o *DeleteLeasesOKBody) validateLeaseStatus(formats strfmt.Registry) error { - if swag.IsZero(o.LeaseStatus) { // not required return nil } @@ -374,14 +517,13 @@ const ( // prop value enum func (o *DeleteLeasesOKBody) validateLeaseStatusReasonEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, deleteLeasesOKBodyTypeLeaseStatusReasonPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, deleteLeasesOKBodyTypeLeaseStatusReasonPropEnum, true); err != nil { return err } return nil } func (o *DeleteLeasesOKBody) validateLeaseStatusReason(formats strfmt.Registry) error { - if swag.IsZero(o.LeaseStatusReason) { // not required return nil } @@ -394,6 +536,11 @@ func (o *DeleteLeasesOKBody) validateLeaseStatusReason(formats strfmt.Registry) return nil } +// ContextValidate validates this delete leases o k body based on context it is used +func (o *DeleteLeasesOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *DeleteLeasesOKBody) MarshalBinary() ([]byte, error) { if o == nil { diff --git a/client/operations/get_accounts_id_parameters.go b/client/operations/get_accounts_id_parameters.go index 1450cca..eb1d2ba 100644 --- a/client/operations/get_accounts_id_parameters.go +++ b/client/operations/get_accounts_id_parameters.go @@ -13,57 +13,57 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetAccountsIDParams creates a new GetAccountsIDParams object -// with the default values initialized. +// NewGetAccountsIDParams creates a new GetAccountsIDParams 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 NewGetAccountsIDParams() *GetAccountsIDParams { - var () return &GetAccountsIDParams{ - timeout: cr.DefaultTimeout, } } // NewGetAccountsIDParamsWithTimeout creates a new GetAccountsIDParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetAccountsIDParamsWithTimeout(timeout time.Duration) *GetAccountsIDParams { - var () return &GetAccountsIDParams{ - timeout: timeout, } } // NewGetAccountsIDParamsWithContext creates a new GetAccountsIDParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetAccountsIDParamsWithContext(ctx context.Context) *GetAccountsIDParams { - var () return &GetAccountsIDParams{ - Context: ctx, } } // NewGetAccountsIDParamsWithHTTPClient creates a new GetAccountsIDParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetAccountsIDParamsWithHTTPClient(client *http.Client) *GetAccountsIDParams { - var () return &GetAccountsIDParams{ HTTPClient: client, } } -/*GetAccountsIDParams contains all the parameters to send to the API endpoint -for the get accounts ID operation typically these are written to a http.Request +/* +GetAccountsIDParams contains all the parameters to send to the API endpoint + + for the get accounts ID operation. + + Typically these are written to a http.Request. */ type GetAccountsIDParams struct { - /*ID - AWS Account ID + /* ID. + AWS Account ID */ ID string @@ -72,6 +72,21 @@ type GetAccountsIDParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get accounts ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountsIDParams) WithDefaults() *GetAccountsIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get accounts ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountsIDParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get accounts ID params func (o *GetAccountsIDParams) WithTimeout(timeout time.Duration) *GetAccountsIDParams { o.SetTimeout(timeout) diff --git a/client/operations/get_accounts_id_responses.go b/client/operations/get_accounts_id_responses.go index 23a634f..2806f76 100644 --- a/client/operations/get_accounts_id_responses.go +++ b/client/operations/get_accounts_id_responses.go @@ -6,16 +6,16 @@ package operations // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "fmt" "io" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - strfmt "github.com/go-openapi/strfmt" ) // GetAccountsIDReader is a Reader for the GetAccountsID structure. @@ -38,9 +38,8 @@ func (o *GetAccountsIDReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[GET /accounts/{id}] GetAccountsID", response, response.Code()) } } @@ -49,22 +48,57 @@ func NewGetAccountsIDOK() *GetAccountsIDOK { return &GetAccountsIDOK{} } -/*GetAccountsIDOK handles this case with default header values. +/* +GetAccountsIDOK describes a response with status code 200, with default header values. GetAccountsIDOK get accounts Id o k */ type GetAccountsIDOK struct { AccessControlAllowHeaders string - AccessControlAllowMethods string - - AccessControlAllowOrigin string + AccessControlAllowOrigin string Payload *GetAccountsIDOKBody } +// IsSuccess returns true when this get accounts Id o k response has a 2xx status code +func (o *GetAccountsIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get accounts Id o k response has a 3xx status code +func (o *GetAccountsIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get accounts Id o k response has a 4xx status code +func (o *GetAccountsIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get accounts Id o k response has a 5xx status code +func (o *GetAccountsIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get accounts Id o k response a status code equal to that given +func (o *GetAccountsIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get accounts Id o k response +func (o *GetAccountsIDOK) Code() int { + return 200 +} + func (o *GetAccountsIDOK) Error() string { - return fmt.Sprintf("[GET /accounts/{id}][%d] getAccountsIdOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /accounts/{id}][%d] getAccountsIdOK %s", 200, payload) +} + +func (o *GetAccountsIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /accounts/{id}][%d] getAccountsIdOK %s", 200, payload) } func (o *GetAccountsIDOK) GetPayload() *GetAccountsIDOKBody { @@ -73,14 +107,26 @@ func (o *GetAccountsIDOK) GetPayload() *GetAccountsIDOKBody { func (o *GetAccountsIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") + + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } + + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } + + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(GetAccountsIDOKBody) @@ -97,15 +143,50 @@ func NewGetAccountsIDForbidden() *GetAccountsIDForbidden { return &GetAccountsIDForbidden{} } -/*GetAccountsIDForbidden handles this case with default header values. +/* +GetAccountsIDForbidden describes a response with status code 403, with default header values. Failed to retrieve account */ type GetAccountsIDForbidden struct { } +// IsSuccess returns true when this get accounts Id forbidden response has a 2xx status code +func (o *GetAccountsIDForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get accounts Id forbidden response has a 3xx status code +func (o *GetAccountsIDForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get accounts Id forbidden response has a 4xx status code +func (o *GetAccountsIDForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this get accounts Id forbidden response has a 5xx status code +func (o *GetAccountsIDForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this get accounts Id forbidden response a status code equal to that given +func (o *GetAccountsIDForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the get accounts Id forbidden response +func (o *GetAccountsIDForbidden) Code() int { + return 403 +} + func (o *GetAccountsIDForbidden) Error() string { - return fmt.Sprintf("[GET /accounts/{id}][%d] getAccountsIdForbidden ", 403) + return fmt.Sprintf("[GET /accounts/{id}][%d] getAccountsIdForbidden", 403) +} + +func (o *GetAccountsIDForbidden) String() string { + return fmt.Sprintf("[GET /accounts/{id}][%d] getAccountsIdForbidden", 403) } func (o *GetAccountsIDForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -113,7 +194,8 @@ func (o *GetAccountsIDForbidden) readResponse(response runtime.ClientResponse, c return nil } -/*GetAccountsIDOKBody Account Details +/* +GetAccountsIDOKBody Account Details swagger:model GetAccountsIDOKBody */ type GetAccountsIDOKBody struct { @@ -123,7 +205,7 @@ type GetAccountsIDOKBody struct { // "NotReady": The account is in "dirty" state, and needs to be reset before it may be leased. // "Leased": The account is leased to a principal // - // Enum: [Ready NotReady Leased Orphaned] + // Enum: ["Ready","NotReady","Leased","Orphaned"] AccountStatus string `json:"accountStatus,omitempty"` // ARN for an IAM role within this AWS account. The DCE master account will assume this IAM role to execute operations within this AWS account. This IAM role is configured by the client, and must be configured with [a Trust Relationship with the DCE master account.](/https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_cross-account-with-roles.html) @@ -191,14 +273,13 @@ const ( // prop value enum func (o *GetAccountsIDOKBody) validateAccountStatusEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, getAccountsIdOKBodyTypeAccountStatusPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, getAccountsIdOKBodyTypeAccountStatusPropEnum, true); err != nil { return err } return nil } func (o *GetAccountsIDOKBody) validateAccountStatus(formats strfmt.Registry) error { - if swag.IsZero(o.AccountStatus) { // not required return nil } @@ -211,6 +292,11 @@ func (o *GetAccountsIDOKBody) validateAccountStatus(formats strfmt.Registry) err return nil } +// ContextValidate validates this get accounts ID o k body based on context it is used +func (o *GetAccountsIDOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *GetAccountsIDOKBody) MarshalBinary() ([]byte, error) { if o == nil { diff --git a/client/operations/get_accounts_parameters.go b/client/operations/get_accounts_parameters.go index 5b8bec5..cee186b 100644 --- a/client/operations/get_accounts_parameters.go +++ b/client/operations/get_accounts_parameters.go @@ -13,88 +13,94 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - - strfmt "github.com/go-openapi/strfmt" ) -// NewGetAccountsParams creates a new GetAccountsParams object -// with the default values initialized. +// NewGetAccountsParams creates a new GetAccountsParams 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 NewGetAccountsParams() *GetAccountsParams { - var () return &GetAccountsParams{ - timeout: cr.DefaultTimeout, } } // NewGetAccountsParamsWithTimeout creates a new GetAccountsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetAccountsParamsWithTimeout(timeout time.Duration) *GetAccountsParams { - var () return &GetAccountsParams{ - timeout: timeout, } } // NewGetAccountsParamsWithContext creates a new GetAccountsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetAccountsParamsWithContext(ctx context.Context) *GetAccountsParams { - var () return &GetAccountsParams{ - Context: ctx, } } // NewGetAccountsParamsWithHTTPClient creates a new GetAccountsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetAccountsParamsWithHTTPClient(client *http.Client) *GetAccountsParams { - var () return &GetAccountsParams{ HTTPClient: client, } } -/*GetAccountsParams contains all the parameters to send to the API endpoint -for the get accounts operation typically these are written to a http.Request +/* +GetAccountsParams contains all the parameters to send to the API endpoint + + for the get accounts operation. + + Typically these are written to a http.Request. */ type GetAccountsParams struct { - /*AdminRoleArn - The Admin Role ARN for the account. + /* AdminRoleArn. + The Admin Role ARN for the account. */ AdminRoleArn *string - /*ID - Account ID. + /* ID. + + Account ID. */ ID *string - /*Limit - The maximum number of accounts to evaluate (not necessarily the number of matching accounts). If there is another page, the URL for page will be in the response Link header. + /* Limit. + + The maximum number of accounts to evaluate (not necessarily the number of matching accounts). If there is another page, the URL for page will be in the response Link header. */ Limit *int64 - /*NextID - Account ID with which to begin the scan operation. This is used to traverse through paginated results. + /* NextID. + + Account ID with which to begin the scan operation. This is used to traverse through paginated results. */ NextID *string - /*PrincipalPolicyHash - The Principal Policy version for the account. + /* PrincipalPolicyHash. + + The Principal Policy version for the account. */ PrincipalPolicyHash *string - /*PrincipalRoleArn - The Principal Role ARN for the account. + /* PrincipalRoleArn. + + The Principal Role ARN for the account. */ PrincipalRoleArn *string - /*Status - Status of the account. + /* Status. + + Status of the account. */ Status *string @@ -103,6 +109,21 @@ type GetAccountsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountsParams) WithDefaults() *GetAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get accounts params func (o *GetAccountsParams) WithTimeout(timeout time.Duration) *GetAccountsParams { o.SetTimeout(timeout) @@ -225,112 +246,119 @@ func (o *GetAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R // query param adminRoleArn var qrAdminRoleArn string + if o.AdminRoleArn != nil { qrAdminRoleArn = *o.AdminRoleArn } qAdminRoleArn := qrAdminRoleArn if qAdminRoleArn != "" { + if err := r.SetQueryParam("adminRoleArn", qAdminRoleArn); err != nil { return err } } - } if o.ID != nil { // query param id var qrID string + if o.ID != nil { qrID = *o.ID } qID := qrID if qID != "" { + if err := r.SetQueryParam("id", qID); err != nil { return err } } - } if o.Limit != nil { // query param limit var qrLimit int64 + if o.Limit != nil { qrLimit = *o.Limit } qLimit := swag.FormatInt64(qrLimit) if qLimit != "" { + if err := r.SetQueryParam("limit", qLimit); err != nil { return err } } - } if o.NextID != nil { // query param nextId var qrNextID string + if o.NextID != nil { qrNextID = *o.NextID } qNextID := qrNextID if qNextID != "" { + if err := r.SetQueryParam("nextId", qNextID); err != nil { return err } } - } if o.PrincipalPolicyHash != nil { // query param principalPolicyHash var qrPrincipalPolicyHash string + if o.PrincipalPolicyHash != nil { qrPrincipalPolicyHash = *o.PrincipalPolicyHash } qPrincipalPolicyHash := qrPrincipalPolicyHash if qPrincipalPolicyHash != "" { + if err := r.SetQueryParam("principalPolicyHash", qPrincipalPolicyHash); err != nil { return err } } - } if o.PrincipalRoleArn != nil { // query param principalRoleArn var qrPrincipalRoleArn string + if o.PrincipalRoleArn != nil { qrPrincipalRoleArn = *o.PrincipalRoleArn } qPrincipalRoleArn := qrPrincipalRoleArn if qPrincipalRoleArn != "" { + if err := r.SetQueryParam("principalRoleArn", qPrincipalRoleArn); err != nil { return err } } - } if o.Status != nil { // query param status var qrStatus string + if o.Status != nil { qrStatus = *o.Status } qStatus := qrStatus if qStatus != "" { + if err := r.SetQueryParam("status", qStatus); err != nil { return err } } - } if len(res) > 0 { diff --git a/client/operations/get_accounts_responses.go b/client/operations/get_accounts_responses.go index 2e1d7c4..2e8564c 100644 --- a/client/operations/get_accounts_responses.go +++ b/client/operations/get_accounts_responses.go @@ -6,16 +6,16 @@ package operations // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "fmt" "io" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - strfmt "github.com/go-openapi/strfmt" ) // GetAccountsReader is a Reader for the GetAccounts structure. @@ -38,9 +38,8 @@ func (o *GetAccountsReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[GET /accounts] GetAccounts", response, response.Code()) } } @@ -49,25 +48,61 @@ func NewGetAccountsOK() *GetAccountsOK { return &GetAccountsOK{} } -/*GetAccountsOK handles this case with default header values. +/* +GetAccountsOK describes a response with status code 200, with default header values. OK */ type GetAccountsOK struct { AccessControlAllowHeaders string - AccessControlAllowMethods string + AccessControlAllowOrigin string - AccessControlAllowOrigin string - /*Appears only when there is another page of results in the query. The value contains the URL for the next page of the results and follows the `; rel="next"` convention. + /* Appears only when there is another page of results in the query. The value contains the URL for the next page of the results and follows the `; rel="next"` convention. */ Link string Payload []*GetAccountsOKBodyItems0 } +// IsSuccess returns true when this get accounts o k response has a 2xx status code +func (o *GetAccountsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get accounts o k response has a 3xx status code +func (o *GetAccountsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get accounts o k response has a 4xx status code +func (o *GetAccountsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get accounts o k response has a 5xx status code +func (o *GetAccountsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get accounts o k response a status code equal to that given +func (o *GetAccountsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get accounts o k response +func (o *GetAccountsOK) Code() int { + return 200 +} + func (o *GetAccountsOK) Error() string { - return fmt.Sprintf("[GET /accounts][%d] getAccountsOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /accounts][%d] getAccountsOK %s", 200, payload) +} + +func (o *GetAccountsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /accounts][%d] getAccountsOK %s", 200, payload) } func (o *GetAccountsOK) GetPayload() []*GetAccountsOKBodyItems0 { @@ -76,17 +111,33 @@ func (o *GetAccountsOK) GetPayload() []*GetAccountsOKBodyItems0 { func (o *GetAccountsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } + + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Link - o.Link = response.GetHeader("Link") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } // response payload if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { @@ -101,15 +152,50 @@ func NewGetAccountsForbidden() *GetAccountsForbidden { return &GetAccountsForbidden{} } -/*GetAccountsForbidden handles this case with default header values. +/* +GetAccountsForbidden describes a response with status code 403, with default header values. Unauthorized */ type GetAccountsForbidden struct { } +// IsSuccess returns true when this get accounts forbidden response has a 2xx status code +func (o *GetAccountsForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get accounts forbidden response has a 3xx status code +func (o *GetAccountsForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get accounts forbidden response has a 4xx status code +func (o *GetAccountsForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this get accounts forbidden response has a 5xx status code +func (o *GetAccountsForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this get accounts forbidden response a status code equal to that given +func (o *GetAccountsForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the get accounts forbidden response +func (o *GetAccountsForbidden) Code() int { + return 403 +} + func (o *GetAccountsForbidden) Error() string { - return fmt.Sprintf("[GET /accounts][%d] getAccountsForbidden ", 403) + return fmt.Sprintf("[GET /accounts][%d] getAccountsForbidden", 403) +} + +func (o *GetAccountsForbidden) String() string { + return fmt.Sprintf("[GET /accounts][%d] getAccountsForbidden", 403) } func (o *GetAccountsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -117,7 +203,8 @@ func (o *GetAccountsForbidden) readResponse(response runtime.ClientResponse, con return nil } -/*GetAccountsOKBodyItems0 Account Details +/* +GetAccountsOKBodyItems0 Account Details swagger:model GetAccountsOKBodyItems0 */ type GetAccountsOKBodyItems0 struct { @@ -127,7 +214,7 @@ type GetAccountsOKBodyItems0 struct { // "NotReady": The account is in "dirty" state, and needs to be reset before it may be leased. // "Leased": The account is leased to a principal // - // Enum: [Ready NotReady Leased Orphaned] + // Enum: ["Ready","NotReady","Leased","Orphaned"] AccountStatus string `json:"accountStatus,omitempty"` // ARN for an IAM role within this AWS account. The DCE master account will assume this IAM role to execute operations within this AWS account. This IAM role is configured by the client, and must be configured with [a Trust Relationship with the DCE master account.](/https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_cross-account-with-roles.html) @@ -195,14 +282,13 @@ const ( // prop value enum func (o *GetAccountsOKBodyItems0) validateAccountStatusEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, getAccountsOKBodyItems0TypeAccountStatusPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, getAccountsOKBodyItems0TypeAccountStatusPropEnum, true); err != nil { return err } return nil } func (o *GetAccountsOKBodyItems0) validateAccountStatus(formats strfmt.Registry) error { - if swag.IsZero(o.AccountStatus) { // not required return nil } @@ -215,6 +301,11 @@ func (o *GetAccountsOKBodyItems0) validateAccountStatus(formats strfmt.Registry) return nil } +// ContextValidate validates this get accounts o k body items0 based on context it is used +func (o *GetAccountsOKBodyItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *GetAccountsOKBodyItems0) MarshalBinary() ([]byte, error) { if o == nil { diff --git a/client/operations/get_auth_file_parameters.go b/client/operations/get_auth_file_parameters.go index ea186e7..ae19a38 100644 --- a/client/operations/get_auth_file_parameters.go +++ b/client/operations/get_auth_file_parameters.go @@ -13,51 +13,51 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetAuthFileParams creates a new GetAuthFileParams object -// with the default values initialized. +// NewGetAuthFileParams creates a new GetAuthFileParams 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 NewGetAuthFileParams() *GetAuthFileParams { - return &GetAuthFileParams{ - timeout: cr.DefaultTimeout, } } // NewGetAuthFileParamsWithTimeout creates a new GetAuthFileParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetAuthFileParamsWithTimeout(timeout time.Duration) *GetAuthFileParams { - return &GetAuthFileParams{ - timeout: timeout, } } // NewGetAuthFileParamsWithContext creates a new GetAuthFileParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetAuthFileParamsWithContext(ctx context.Context) *GetAuthFileParams { - return &GetAuthFileParams{ - Context: ctx, } } // NewGetAuthFileParamsWithHTTPClient creates a new GetAuthFileParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetAuthFileParamsWithHTTPClient(client *http.Client) *GetAuthFileParams { - return &GetAuthFileParams{ HTTPClient: client, } } -/*GetAuthFileParams contains all the parameters to send to the API endpoint -for the get auth file operation typically these are written to a http.Request +/* +GetAuthFileParams contains all the parameters to send to the API endpoint + + for the get auth file operation. + + Typically these are written to a http.Request. */ type GetAuthFileParams struct { timeout time.Duration @@ -65,6 +65,21 @@ type GetAuthFileParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get auth file params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAuthFileParams) WithDefaults() *GetAuthFileParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get auth file params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAuthFileParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get auth file params func (o *GetAuthFileParams) WithTimeout(timeout time.Duration) *GetAuthFileParams { o.SetTimeout(timeout) diff --git a/client/operations/get_auth_file_responses.go b/client/operations/get_auth_file_responses.go index c3ba597..3f9d776 100644 --- a/client/operations/get_auth_file_responses.go +++ b/client/operations/get_auth_file_responses.go @@ -6,12 +6,12 @@ package operations // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" "fmt" "io" "github.com/go-openapi/runtime" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) // GetAuthFileReader is a Reader for the GetAuthFile structure. @@ -28,9 +28,8 @@ func (o *GetAuthFileReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[GET /auth/{file+}] GetAuthFile", response, response.Code()) } } @@ -39,22 +38,57 @@ func NewGetAuthFileOK() *GetAuthFileOK { return &GetAuthFileOK{} } -/*GetAuthFileOK handles this case with default header values. +/* +GetAuthFileOK describes a response with status code 200, with default header values. GetAuthFileOK get auth file o k */ type GetAuthFileOK struct { AccessControlAllowHeaders string - AccessControlAllowMethods string - - AccessControlAllowOrigin string + AccessControlAllowOrigin string Payload interface{} } +// IsSuccess returns true when this get auth file o k response has a 2xx status code +func (o *GetAuthFileOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get auth file o k response has a 3xx status code +func (o *GetAuthFileOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get auth file o k response has a 4xx status code +func (o *GetAuthFileOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get auth file o k response has a 5xx status code +func (o *GetAuthFileOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get auth file o k response a status code equal to that given +func (o *GetAuthFileOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get auth file o k response +func (o *GetAuthFileOK) Code() int { + return 200 +} + func (o *GetAuthFileOK) Error() string { - return fmt.Sprintf("[GET /auth/{file+}][%d] getAuthFileOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /auth/{file+}][%d] getAuthFileOK %s", 200, payload) +} + +func (o *GetAuthFileOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /auth/{file+}][%d] getAuthFileOK %s", 200, payload) } func (o *GetAuthFileOK) GetPayload() interface{} { @@ -63,14 +97,26 @@ func (o *GetAuthFileOK) GetPayload() interface{} { func (o *GetAuthFileOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } + + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") + + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } + + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } // response payload if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { diff --git a/client/operations/get_auth_parameters.go b/client/operations/get_auth_parameters.go index 3d0d1fa..87f48c4 100644 --- a/client/operations/get_auth_parameters.go +++ b/client/operations/get_auth_parameters.go @@ -13,51 +13,51 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetAuthParams creates a new GetAuthParams object -// with the default values initialized. +// NewGetAuthParams creates a new GetAuthParams 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 NewGetAuthParams() *GetAuthParams { - return &GetAuthParams{ - timeout: cr.DefaultTimeout, } } // NewGetAuthParamsWithTimeout creates a new GetAuthParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetAuthParamsWithTimeout(timeout time.Duration) *GetAuthParams { - return &GetAuthParams{ - timeout: timeout, } } // NewGetAuthParamsWithContext creates a new GetAuthParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetAuthParamsWithContext(ctx context.Context) *GetAuthParams { - return &GetAuthParams{ - Context: ctx, } } // NewGetAuthParamsWithHTTPClient creates a new GetAuthParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetAuthParamsWithHTTPClient(client *http.Client) *GetAuthParams { - return &GetAuthParams{ HTTPClient: client, } } -/*GetAuthParams contains all the parameters to send to the API endpoint -for the get auth operation typically these are written to a http.Request +/* +GetAuthParams contains all the parameters to send to the API endpoint + + for the get auth operation. + + Typically these are written to a http.Request. */ type GetAuthParams struct { timeout time.Duration @@ -65,6 +65,21 @@ type GetAuthParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get auth params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAuthParams) WithDefaults() *GetAuthParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get auth params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAuthParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get auth params func (o *GetAuthParams) WithTimeout(timeout time.Duration) *GetAuthParams { o.SetTimeout(timeout) diff --git a/client/operations/get_auth_responses.go b/client/operations/get_auth_responses.go index 0112b4d..e6dca5f 100644 --- a/client/operations/get_auth_responses.go +++ b/client/operations/get_auth_responses.go @@ -6,12 +6,12 @@ package operations // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" "fmt" "io" "github.com/go-openapi/runtime" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) // GetAuthReader is a Reader for the GetAuth structure. @@ -28,9 +28,8 @@ func (o *GetAuthReader) ReadResponse(response runtime.ClientResponse, consumer r return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[GET /auth] GetAuth", response, response.Code()) } } @@ -39,22 +38,57 @@ func NewGetAuthOK() *GetAuthOK { return &GetAuthOK{} } -/*GetAuthOK handles this case with default header values. +/* +GetAuthOK describes a response with status code 200, with default header values. GetAuthOK get auth o k */ type GetAuthOK struct { AccessControlAllowHeaders string - AccessControlAllowMethods string - - AccessControlAllowOrigin string + AccessControlAllowOrigin string Payload interface{} } +// IsSuccess returns true when this get auth o k response has a 2xx status code +func (o *GetAuthOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get auth o k response has a 3xx status code +func (o *GetAuthOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get auth o k response has a 4xx status code +func (o *GetAuthOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get auth o k response has a 5xx status code +func (o *GetAuthOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get auth o k response a status code equal to that given +func (o *GetAuthOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get auth o k response +func (o *GetAuthOK) Code() int { + return 200 +} + func (o *GetAuthOK) Error() string { - return fmt.Sprintf("[GET /auth][%d] getAuthOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /auth][%d] getAuthOK %s", 200, payload) +} + +func (o *GetAuthOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /auth][%d] getAuthOK %s", 200, payload) } func (o *GetAuthOK) GetPayload() interface{} { @@ -63,14 +97,26 @@ func (o *GetAuthOK) GetPayload() interface{} { func (o *GetAuthOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } + + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") + + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } + + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } // response payload if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { diff --git a/client/operations/get_leases_id_parameters.go b/client/operations/get_leases_id_parameters.go index fcfc3e1..1e62ad8 100644 --- a/client/operations/get_leases_id_parameters.go +++ b/client/operations/get_leases_id_parameters.go @@ -13,57 +13,57 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetLeasesIDParams creates a new GetLeasesIDParams object -// with the default values initialized. +// NewGetLeasesIDParams creates a new GetLeasesIDParams 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 NewGetLeasesIDParams() *GetLeasesIDParams { - var () return &GetLeasesIDParams{ - timeout: cr.DefaultTimeout, } } // NewGetLeasesIDParamsWithTimeout creates a new GetLeasesIDParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetLeasesIDParamsWithTimeout(timeout time.Duration) *GetLeasesIDParams { - var () return &GetLeasesIDParams{ - timeout: timeout, } } // NewGetLeasesIDParamsWithContext creates a new GetLeasesIDParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetLeasesIDParamsWithContext(ctx context.Context) *GetLeasesIDParams { - var () return &GetLeasesIDParams{ - Context: ctx, } } // NewGetLeasesIDParamsWithHTTPClient creates a new GetLeasesIDParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetLeasesIDParamsWithHTTPClient(client *http.Client) *GetLeasesIDParams { - var () return &GetLeasesIDParams{ HTTPClient: client, } } -/*GetLeasesIDParams contains all the parameters to send to the API endpoint -for the get leases ID operation typically these are written to a http.Request +/* +GetLeasesIDParams contains all the parameters to send to the API endpoint + + for the get leases ID operation. + + Typically these are written to a http.Request. */ type GetLeasesIDParams struct { - /*ID - Id for lease + /* ID. + Id for lease */ ID string @@ -72,6 +72,21 @@ type GetLeasesIDParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get leases ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLeasesIDParams) WithDefaults() *GetLeasesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get leases ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLeasesIDParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get leases ID params func (o *GetLeasesIDParams) WithTimeout(timeout time.Duration) *GetLeasesIDParams { o.SetTimeout(timeout) diff --git a/client/operations/get_leases_id_responses.go b/client/operations/get_leases_id_responses.go index 3db7bb9..d66d82f 100644 --- a/client/operations/get_leases_id_responses.go +++ b/client/operations/get_leases_id_responses.go @@ -6,16 +6,16 @@ package operations // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "fmt" "io" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - strfmt "github.com/go-openapi/strfmt" ) // GetLeasesIDReader is a Reader for the GetLeasesID structure. @@ -38,9 +38,8 @@ func (o *GetLeasesIDReader) ReadResponse(response runtime.ClientResponse, consum return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[GET /leases/{id}] GetLeasesID", response, response.Code()) } } @@ -49,22 +48,57 @@ func NewGetLeasesIDOK() *GetLeasesIDOK { return &GetLeasesIDOK{} } -/*GetLeasesIDOK handles this case with default header values. +/* +GetLeasesIDOK describes a response with status code 200, with default header values. GetLeasesIDOK get leases Id o k */ type GetLeasesIDOK struct { AccessControlAllowHeaders string - AccessControlAllowMethods string - - AccessControlAllowOrigin string + AccessControlAllowOrigin string Payload *GetLeasesIDOKBody } +// IsSuccess returns true when this get leases Id o k response has a 2xx status code +func (o *GetLeasesIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get leases Id o k response has a 3xx status code +func (o *GetLeasesIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get leases Id o k response has a 4xx status code +func (o *GetLeasesIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get leases Id o k response has a 5xx status code +func (o *GetLeasesIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get leases Id o k response a status code equal to that given +func (o *GetLeasesIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get leases Id o k response +func (o *GetLeasesIDOK) Code() int { + return 200 +} + func (o *GetLeasesIDOK) Error() string { - return fmt.Sprintf("[GET /leases/{id}][%d] getLeasesIdOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /leases/{id}][%d] getLeasesIdOK %s", 200, payload) +} + +func (o *GetLeasesIDOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /leases/{id}][%d] getLeasesIdOK %s", 200, payload) } func (o *GetLeasesIDOK) GetPayload() *GetLeasesIDOKBody { @@ -73,14 +107,26 @@ func (o *GetLeasesIDOK) GetPayload() *GetLeasesIDOKBody { func (o *GetLeasesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") + + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") + + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(GetLeasesIDOKBody) @@ -97,15 +143,50 @@ func NewGetLeasesIDForbidden() *GetLeasesIDForbidden { return &GetLeasesIDForbidden{} } -/*GetLeasesIDForbidden handles this case with default header values. +/* +GetLeasesIDForbidden describes a response with status code 403, with default header values. Failed to retrieve lease */ type GetLeasesIDForbidden struct { } +// IsSuccess returns true when this get leases Id forbidden response has a 2xx status code +func (o *GetLeasesIDForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get leases Id forbidden response has a 3xx status code +func (o *GetLeasesIDForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get leases Id forbidden response has a 4xx status code +func (o *GetLeasesIDForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this get leases Id forbidden response has a 5xx status code +func (o *GetLeasesIDForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this get leases Id forbidden response a status code equal to that given +func (o *GetLeasesIDForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the get leases Id forbidden response +func (o *GetLeasesIDForbidden) Code() int { + return 403 +} + func (o *GetLeasesIDForbidden) Error() string { - return fmt.Sprintf("[GET /leases/{id}][%d] getLeasesIdForbidden ", 403) + return fmt.Sprintf("[GET /leases/{id}][%d] getLeasesIdForbidden", 403) +} + +func (o *GetLeasesIDForbidden) String() string { + return fmt.Sprintf("[GET /leases/{id}][%d] getLeasesIdForbidden", 403) } func (o *GetLeasesIDForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -113,7 +194,8 @@ func (o *GetLeasesIDForbidden) readResponse(response runtime.ClientResponse, con return nil } -/*GetLeasesIDOKBody Lease Details +/* +GetLeasesIDOKBody Lease Details swagger:model GetLeasesIDOKBody */ type GetLeasesIDOKBody struct { @@ -146,7 +228,7 @@ type GetLeasesIDOKBody struct { // "Active": The principal is leased and has access to the account // "Inactive": The lease has become inactive, either through expiring, exceeding budget, or by request. // - // Enum: [Active Inactive] + // Enum: ["Active","Inactive"] LeaseStatus string `json:"leaseStatus,omitempty"` // date lease status was last modified in epoch seconds @@ -163,7 +245,7 @@ type GetLeasesIDOKBody struct { // "LeaseRolledBack": A system error occurred while provisioning the lease. // and it was rolled back. // - // Enum: [LeaseExpired LeaseOverBudget LeaseDestroyed LeaseActive LeaseRolledBack] + // Enum: ["LeaseExpired","LeaseOverBudget","LeaseDestroyed","LeaseActive","LeaseRolledBack"] LeaseStatusReason string `json:"leaseStatusReason,omitempty"` // principalId of the lease to get @@ -211,14 +293,13 @@ const ( // prop value enum func (o *GetLeasesIDOKBody) validateLeaseStatusEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, getLeasesIdOKBodyTypeLeaseStatusPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, getLeasesIdOKBodyTypeLeaseStatusPropEnum, true); err != nil { return err } return nil } func (o *GetLeasesIDOKBody) validateLeaseStatus(formats strfmt.Registry) error { - if swag.IsZero(o.LeaseStatus) { // not required return nil } @@ -263,14 +344,13 @@ const ( // prop value enum func (o *GetLeasesIDOKBody) validateLeaseStatusReasonEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, getLeasesIdOKBodyTypeLeaseStatusReasonPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, getLeasesIdOKBodyTypeLeaseStatusReasonPropEnum, true); err != nil { return err } return nil } func (o *GetLeasesIDOKBody) validateLeaseStatusReason(formats strfmt.Registry) error { - if swag.IsZero(o.LeaseStatusReason) { // not required return nil } @@ -283,6 +363,11 @@ func (o *GetLeasesIDOKBody) validateLeaseStatusReason(formats strfmt.Registry) e return nil } +// ContextValidate validates this get leases ID o k body based on context it is used +func (o *GetLeasesIDOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *GetLeasesIDOKBody) MarshalBinary() ([]byte, error) { if o == nil { diff --git a/client/operations/get_leases_parameters.go b/client/operations/get_leases_parameters.go index de66c05..fb3ec3b 100644 --- a/client/operations/get_leases_parameters.go +++ b/client/operations/get_leases_parameters.go @@ -13,83 +13,88 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - - strfmt "github.com/go-openapi/strfmt" ) -// NewGetLeasesParams creates a new GetLeasesParams object -// with the default values initialized. +// NewGetLeasesParams creates a new GetLeasesParams 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 NewGetLeasesParams() *GetLeasesParams { - var () return &GetLeasesParams{ - timeout: cr.DefaultTimeout, } } // NewGetLeasesParamsWithTimeout creates a new GetLeasesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetLeasesParamsWithTimeout(timeout time.Duration) *GetLeasesParams { - var () return &GetLeasesParams{ - timeout: timeout, } } // NewGetLeasesParamsWithContext creates a new GetLeasesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetLeasesParamsWithContext(ctx context.Context) *GetLeasesParams { - var () return &GetLeasesParams{ - Context: ctx, } } // NewGetLeasesParamsWithHTTPClient creates a new GetLeasesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetLeasesParamsWithHTTPClient(client *http.Client) *GetLeasesParams { - var () return &GetLeasesParams{ HTTPClient: client, } } -/*GetLeasesParams contains all the parameters to send to the API endpoint -for the get leases operation typically these are written to a http.Request +/* +GetLeasesParams contains all the parameters to send to the API endpoint + + for the get leases operation. + + Typically these are written to a http.Request. */ type GetLeasesParams struct { - /*AccountID - Account ID of the leases. + /* AccountID. + Account ID of the leases. */ AccountID *string - /*Limit - The maximum number of leases to evaluate (not necessarily the number of matching leases). If there is another page, the URL for page will be in the response Link header. + /* Limit. + + The maximum number of leases to evaluate (not necessarily the number of matching leases). If there is another page, the URL for page will be in the response Link header. */ Limit *int64 - /*NextAccountID - Account ID with which to begin the scan operation. This is used to traverse through paginated results. + /* NextAccountID. + + Account ID with which to begin the scan operation. This is used to traverse through paginated results. */ NextAccountID *string - /*NextPrincipalID - Principal ID with which to begin the scan operation. This is used to traverse through paginated results. + /* NextPrincipalID. + + Principal ID with which to begin the scan operation. This is used to traverse through paginated results. */ NextPrincipalID *string - /*PrincipalID - Principal ID of the leases. + /* PrincipalID. + + Principal ID of the leases. */ PrincipalID *string - /*Status - Status of the leases. + /* Status. + + Status of the leases. */ Status *string @@ -98,6 +103,21 @@ type GetLeasesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get leases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLeasesParams) WithDefaults() *GetLeasesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get leases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLeasesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get leases params func (o *GetLeasesParams) WithTimeout(timeout time.Duration) *GetLeasesParams { o.SetTimeout(timeout) @@ -209,96 +229,102 @@ func (o *GetLeasesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg // query param accountId var qrAccountID string + if o.AccountID != nil { qrAccountID = *o.AccountID } qAccountID := qrAccountID if qAccountID != "" { + if err := r.SetQueryParam("accountId", qAccountID); err != nil { return err } } - } if o.Limit != nil { // query param limit var qrLimit int64 + if o.Limit != nil { qrLimit = *o.Limit } qLimit := swag.FormatInt64(qrLimit) if qLimit != "" { + if err := r.SetQueryParam("limit", qLimit); err != nil { return err } } - } if o.NextAccountID != nil { // query param nextAccountId var qrNextAccountID string + if o.NextAccountID != nil { qrNextAccountID = *o.NextAccountID } qNextAccountID := qrNextAccountID if qNextAccountID != "" { + if err := r.SetQueryParam("nextAccountId", qNextAccountID); err != nil { return err } } - } if o.NextPrincipalID != nil { // query param nextPrincipalId var qrNextPrincipalID string + if o.NextPrincipalID != nil { qrNextPrincipalID = *o.NextPrincipalID } qNextPrincipalID := qrNextPrincipalID if qNextPrincipalID != "" { + if err := r.SetQueryParam("nextPrincipalId", qNextPrincipalID); err != nil { return err } } - } if o.PrincipalID != nil { // query param principalId var qrPrincipalID string + if o.PrincipalID != nil { qrPrincipalID = *o.PrincipalID } qPrincipalID := qrPrincipalID if qPrincipalID != "" { + if err := r.SetQueryParam("principalId", qPrincipalID); err != nil { return err } } - } if o.Status != nil { // query param status var qrStatus string + if o.Status != nil { qrStatus = *o.Status } qStatus := qrStatus if qStatus != "" { + if err := r.SetQueryParam("status", qStatus); err != nil { return err } } - } if len(res) > 0 { diff --git a/client/operations/get_leases_responses.go b/client/operations/get_leases_responses.go index c3fc3a2..9d33793 100644 --- a/client/operations/get_leases_responses.go +++ b/client/operations/get_leases_responses.go @@ -6,16 +6,16 @@ package operations // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "fmt" "io" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - strfmt "github.com/go-openapi/strfmt" ) // GetLeasesReader is a Reader for the GetLeases structure. @@ -44,9 +44,8 @@ func (o *GetLeasesReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[GET /leases] GetLeases", response, response.Code()) } } @@ -55,25 +54,61 @@ func NewGetLeasesOK() *GetLeasesOK { return &GetLeasesOK{} } -/*GetLeasesOK handles this case with default header values. +/* +GetLeasesOK describes a response with status code 200, with default header values. OK */ type GetLeasesOK struct { AccessControlAllowHeaders string - AccessControlAllowMethods string + AccessControlAllowOrigin string - AccessControlAllowOrigin string - /*Appears only when there is another page of results in the query. The value contains the URL for the next page of the results and follows the `; rel="next"` convention. + /* Appears only when there is another page of results in the query. The value contains the URL for the next page of the results and follows the `; rel="next"` convention. */ Link string Payload []*GetLeasesOKBodyItems0 } +// IsSuccess returns true when this get leases o k response has a 2xx status code +func (o *GetLeasesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get leases o k response has a 3xx status code +func (o *GetLeasesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get leases o k response has a 4xx status code +func (o *GetLeasesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get leases o k response has a 5xx status code +func (o *GetLeasesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get leases o k response a status code equal to that given +func (o *GetLeasesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get leases o k response +func (o *GetLeasesOK) Code() int { + return 200 +} + func (o *GetLeasesOK) Error() string { - return fmt.Sprintf("[GET /leases][%d] getLeasesOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /leases][%d] getLeasesOK %s", 200, payload) +} + +func (o *GetLeasesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /leases][%d] getLeasesOK %s", 200, payload) } func (o *GetLeasesOK) GetPayload() []*GetLeasesOKBodyItems0 { @@ -82,17 +117,33 @@ func (o *GetLeasesOK) GetPayload() []*GetLeasesOKBodyItems0 { func (o *GetLeasesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") + + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } + + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") + + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } - // response header Link - o.Link = response.GetHeader("Link") + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } // response payload if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { @@ -107,16 +158,50 @@ func NewGetLeasesBadRequest() *GetLeasesBadRequest { return &GetLeasesBadRequest{} } -/*GetLeasesBadRequest handles this case with default header values. +/* +GetLeasesBadRequest describes a response with status code 400, with default header values. "Failed to Parse Request Body" if the request body is blank or incorrectly formatted. - */ type GetLeasesBadRequest struct { } +// IsSuccess returns true when this get leases bad request response has a 2xx status code +func (o *GetLeasesBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get leases bad request response has a 3xx status code +func (o *GetLeasesBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get leases bad request response has a 4xx status code +func (o *GetLeasesBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this get leases bad request response has a 5xx status code +func (o *GetLeasesBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this get leases bad request response a status code equal to that given +func (o *GetLeasesBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the get leases bad request response +func (o *GetLeasesBadRequest) Code() int { + return 400 +} + func (o *GetLeasesBadRequest) Error() string { - return fmt.Sprintf("[GET /leases][%d] getLeasesBadRequest ", 400) + return fmt.Sprintf("[GET /leases][%d] getLeasesBadRequest", 400) +} + +func (o *GetLeasesBadRequest) String() string { + return fmt.Sprintf("[GET /leases][%d] getLeasesBadRequest", 400) } func (o *GetLeasesBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -129,15 +214,50 @@ func NewGetLeasesForbidden() *GetLeasesForbidden { return &GetLeasesForbidden{} } -/*GetLeasesForbidden handles this case with default header values. +/* +GetLeasesForbidden describes a response with status code 403, with default header values. Failed to authenticate request */ type GetLeasesForbidden struct { } +// IsSuccess returns true when this get leases forbidden response has a 2xx status code +func (o *GetLeasesForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get leases forbidden response has a 3xx status code +func (o *GetLeasesForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get leases forbidden response has a 4xx status code +func (o *GetLeasesForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this get leases forbidden response has a 5xx status code +func (o *GetLeasesForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this get leases forbidden response a status code equal to that given +func (o *GetLeasesForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the get leases forbidden response +func (o *GetLeasesForbidden) Code() int { + return 403 +} + func (o *GetLeasesForbidden) Error() string { - return fmt.Sprintf("[GET /leases][%d] getLeasesForbidden ", 403) + return fmt.Sprintf("[GET /leases][%d] getLeasesForbidden", 403) +} + +func (o *GetLeasesForbidden) String() string { + return fmt.Sprintf("[GET /leases][%d] getLeasesForbidden", 403) } func (o *GetLeasesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -145,7 +265,8 @@ func (o *GetLeasesForbidden) readResponse(response runtime.ClientResponse, consu return nil } -/*GetLeasesOKBodyItems0 Lease Details +/* +GetLeasesOKBodyItems0 Lease Details swagger:model GetLeasesOKBodyItems0 */ type GetLeasesOKBodyItems0 struct { @@ -178,7 +299,7 @@ type GetLeasesOKBodyItems0 struct { // "Active": The principal is leased and has access to the account // "Inactive": The lease has become inactive, either through expiring, exceeding budget, or by request. // - // Enum: [Active Inactive] + // Enum: ["Active","Inactive"] LeaseStatus string `json:"leaseStatus,omitempty"` // date lease status was last modified in epoch seconds @@ -195,7 +316,7 @@ type GetLeasesOKBodyItems0 struct { // "LeaseRolledBack": A system error occurred while provisioning the lease. // and it was rolled back. // - // Enum: [LeaseExpired LeaseOverBudget LeaseDestroyed LeaseActive LeaseRolledBack] + // Enum: ["LeaseExpired","LeaseOverBudget","LeaseDestroyed","LeaseActive","LeaseRolledBack"] LeaseStatusReason string `json:"leaseStatusReason,omitempty"` // principalId of the lease to get @@ -243,14 +364,13 @@ const ( // prop value enum func (o *GetLeasesOKBodyItems0) validateLeaseStatusEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, getLeasesOKBodyItems0TypeLeaseStatusPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, getLeasesOKBodyItems0TypeLeaseStatusPropEnum, true); err != nil { return err } return nil } func (o *GetLeasesOKBodyItems0) validateLeaseStatus(formats strfmt.Registry) error { - if swag.IsZero(o.LeaseStatus) { // not required return nil } @@ -295,14 +415,13 @@ const ( // prop value enum func (o *GetLeasesOKBodyItems0) validateLeaseStatusReasonEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, getLeasesOKBodyItems0TypeLeaseStatusReasonPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, getLeasesOKBodyItems0TypeLeaseStatusReasonPropEnum, true); err != nil { return err } return nil } func (o *GetLeasesOKBodyItems0) validateLeaseStatusReason(formats strfmt.Registry) error { - if swag.IsZero(o.LeaseStatusReason) { // not required return nil } @@ -315,6 +434,11 @@ func (o *GetLeasesOKBodyItems0) validateLeaseStatusReason(formats strfmt.Registr return nil } +// ContextValidate validates this get leases o k body items0 based on context it is used +func (o *GetLeasesOKBodyItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *GetLeasesOKBodyItems0) MarshalBinary() ([]byte, error) { if o == nil { diff --git a/client/operations/get_usage_parameters.go b/client/operations/get_usage_parameters.go index 2d468a9..80bbd93 100644 --- a/client/operations/get_usage_parameters.go +++ b/client/operations/get_usage_parameters.go @@ -13,63 +13,64 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - - strfmt "github.com/go-openapi/strfmt" ) -// NewGetUsageParams creates a new GetUsageParams object -// with the default values initialized. +// NewGetUsageParams creates a new GetUsageParams 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 NewGetUsageParams() *GetUsageParams { - var () return &GetUsageParams{ - timeout: cr.DefaultTimeout, } } // NewGetUsageParamsWithTimeout creates a new GetUsageParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetUsageParamsWithTimeout(timeout time.Duration) *GetUsageParams { - var () return &GetUsageParams{ - timeout: timeout, } } // NewGetUsageParamsWithContext creates a new GetUsageParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetUsageParamsWithContext(ctx context.Context) *GetUsageParams { - var () return &GetUsageParams{ - Context: ctx, } } // NewGetUsageParamsWithHTTPClient creates a new GetUsageParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetUsageParamsWithHTTPClient(client *http.Client) *GetUsageParams { - var () return &GetUsageParams{ HTTPClient: client, } } -/*GetUsageParams contains all the parameters to send to the API endpoint -for the get usage operation typically these are written to a http.Request +/* +GetUsageParams contains all the parameters to send to the API endpoint + + for the get usage operation. + + Typically these are written to a http.Request. */ type GetUsageParams struct { - /*EndDate - end date of the usage + /* EndDate. + end date of the usage */ EndDate float64 - /*StartDate - start date of the usage + /* StartDate. + + start date of the usage */ StartDate float64 @@ -78,6 +79,21 @@ type GetUsageParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get usage params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUsageParams) WithDefaults() *GetUsageParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get usage params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUsageParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get usage params func (o *GetUsageParams) WithTimeout(timeout time.Duration) *GetUsageParams { o.SetTimeout(timeout) diff --git a/client/operations/get_usage_responses.go b/client/operations/get_usage_responses.go index 66be731..b59a3a2 100644 --- a/client/operations/get_usage_responses.go +++ b/client/operations/get_usage_responses.go @@ -6,13 +6,14 @@ package operations // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "encoding/json" "fmt" "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - - strfmt "github.com/go-openapi/strfmt" ) // GetUsageReader is a Reader for the GetUsage structure. @@ -35,9 +36,8 @@ func (o *GetUsageReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[GET /usage] GetUsage", response, response.Code()) } } @@ -46,43 +46,88 @@ func NewGetUsageOK() *GetUsageOK { return &GetUsageOK{} } -/*GetUsageOK handles this case with default header values. +/* +GetUsageOK describes a response with status code 200, with default header values. GetUsageOK get usage o k */ type GetUsageOK struct { AccessControlAllowHeaders string - AccessControlAllowMethods string + AccessControlAllowOrigin string + + Payload []*GetUsageOKBodyItems0 +} - AccessControlAllowOrigin string +// IsSuccess returns true when this get usage o k response has a 2xx status code +func (o *GetUsageOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get usage o k response has a 3xx status code +func (o *GetUsageOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get usage o k response has a 4xx status code +func (o *GetUsageOK) IsClientError() bool { + return false +} - Payload *GetUsageOKBody +// IsServerError returns true when this get usage o k response has a 5xx status code +func (o *GetUsageOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get usage o k response a status code equal to that given +func (o *GetUsageOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get usage o k response +func (o *GetUsageOK) Code() int { + return 200 } func (o *GetUsageOK) Error() string { - return fmt.Sprintf("[GET /usage][%d] getUsageOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /usage][%d] getUsageOK %s", 200, payload) } -func (o *GetUsageOK) GetPayload() *GetUsageOKBody { +func (o *GetUsageOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /usage][%d] getUsageOK %s", 200, payload) +} + +func (o *GetUsageOK) GetPayload() []*GetUsageOKBodyItems0 { return o.Payload } func (o *GetUsageOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") + + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } + + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") - o.Payload = new(GetUsageOKBody) + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { return err } @@ -94,15 +139,50 @@ func NewGetUsageForbidden() *GetUsageForbidden { return &GetUsageForbidden{} } -/*GetUsageForbidden handles this case with default header values. +/* +GetUsageForbidden describes a response with status code 403, with default header values. Failed to authenticate request */ type GetUsageForbidden struct { } +// IsSuccess returns true when this get usage forbidden response has a 2xx status code +func (o *GetUsageForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get usage forbidden response has a 3xx status code +func (o *GetUsageForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get usage forbidden response has a 4xx status code +func (o *GetUsageForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this get usage forbidden response has a 5xx status code +func (o *GetUsageForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this get usage forbidden response a status code equal to that given +func (o *GetUsageForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the get usage forbidden response +func (o *GetUsageForbidden) Code() int { + return 403 +} + func (o *GetUsageForbidden) Error() string { - return fmt.Sprintf("[GET /usage][%d] getUsageForbidden ", 403) + return fmt.Sprintf("[GET /usage][%d] getUsageForbidden", 403) +} + +func (o *GetUsageForbidden) String() string { + return fmt.Sprintf("[GET /usage][%d] getUsageForbidden", 403) } func (o *GetUsageForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -110,10 +190,11 @@ func (o *GetUsageForbidden) readResponse(response runtime.ClientResponse, consum return nil } -/*GetUsageOKBody usage cost of the aws account from start date to end date -swagger:model GetUsageOKBody +/* +GetUsageOKBodyItems0 get usage o k body items0 +swagger:model GetUsageOKBodyItems0 */ -type GetUsageOKBody struct { +type GetUsageOKBodyItems0 struct { // accountId of the AWS account AccountID string `json:"accountId,omitempty"` @@ -138,13 +219,18 @@ type GetUsageOKBody struct { TimeToLive float64 `json:"timeToLive,omitempty"` } -// Validate validates this get usage o k body -func (o *GetUsageOKBody) Validate(formats strfmt.Registry) error { +// Validate validates this get usage o k body items0 +func (o *GetUsageOKBodyItems0) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this get usage o k body items0 based on context it is used +func (o *GetUsageOKBodyItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation -func (o *GetUsageOKBody) MarshalBinary() ([]byte, error) { +func (o *GetUsageOKBodyItems0) MarshalBinary() ([]byte, error) { if o == nil { return nil, nil } @@ -152,8 +238,8 @@ func (o *GetUsageOKBody) MarshalBinary() ([]byte, error) { } // UnmarshalBinary interface implementation -func (o *GetUsageOKBody) UnmarshalBinary(b []byte) error { - var res GetUsageOKBody +func (o *GetUsageOKBodyItems0) UnmarshalBinary(b []byte) error { + var res GetUsageOKBodyItems0 if err := swag.ReadJSON(b, &res); err != nil { return err } diff --git a/client/operations/operations_client.go b/client/operations/operations_client.go index 4b82119..f5419ff 100644 --- a/client/operations/operations_client.go +++ b/client/operations/operations_client.go @@ -9,6 +9,7 @@ import ( "fmt" "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" ) @@ -17,6 +18,31 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientServi return &Client{transport: transport, formats: formats} } +// New creates a new operations API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new operations API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + /* Client for operations API */ @@ -25,51 +51,85 @@ type Client struct { formats strfmt.Registry } +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithAccept allows the client to force the Accept header +// to negotiate a specific Producer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithAccept(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{mime} + } +} + +// WithAcceptApplicationJSON sets the Accept header to "application/json". +func WithAcceptApplicationJSON(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{"application/json"} +} + +// WithAcceptTextCSS sets the Accept header to "text/css". +func WithAcceptTextCSS(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{"text/css"} +} + +// WithAcceptTextHTML sets the Accept header to "text/html". +func WithAcceptTextHTML(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{"text/html"} +} + +// WithAcceptTextJavascript sets the Accept header to "text/javascript". +func WithAcceptTextJavascript(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{"text/javascript"} +} + // ClientService is the interface for Client methods type ClientService interface { - DeleteAccountsID(params *DeleteAccountsIDParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteAccountsIDNoContent, error) - - DeleteLeases(params *DeleteLeasesParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteLeasesOK, error) + DeleteAccountsID(params *DeleteAccountsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAccountsIDNoContent, error) - DeleteLeasesID(params *DeleteLeasesIDParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteLeasesIDOK, error) + DeleteLeases(params *DeleteLeasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteLeasesOK, error) - GetAccounts(params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountsOK, error) + DeleteLeasesID(params *DeleteLeasesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteLeasesIDOK, error) - GetAccountsID(params *GetAccountsIDParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountsIDOK, error) + GetAccounts(params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountsOK, error) - GetAuth(params *GetAuthParams) (*GetAuthOK, error) + GetAccountsID(params *GetAccountsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountsIDOK, error) - GetAuthFile(params *GetAuthFileParams) (*GetAuthFileOK, error) + GetAuth(params *GetAuthParams, opts ...ClientOption) (*GetAuthOK, error) - GetLeases(params *GetLeasesParams, authInfo runtime.ClientAuthInfoWriter) (*GetLeasesOK, error) + GetAuthFile(params *GetAuthFileParams, opts ...ClientOption) (*GetAuthFileOK, error) - GetLeasesID(params *GetLeasesIDParams, authInfo runtime.ClientAuthInfoWriter) (*GetLeasesIDOK, error) + GetLeases(params *GetLeasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLeasesOK, error) - GetUsage(params *GetUsageParams, authInfo runtime.ClientAuthInfoWriter) (*GetUsageOK, error) + GetLeasesID(params *GetLeasesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLeasesIDOK, error) - PostAccounts(params *PostAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PostAccountsCreated, error) + GetUsage(params *GetUsageParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUsageOK, error) - PostLeases(params *PostLeasesParams, authInfo runtime.ClientAuthInfoWriter) (*PostLeasesCreated, error) + PostAccounts(params *PostAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAccountsCreated, error) - PostLeasesAuth(params *PostLeasesAuthParams, authInfo runtime.ClientAuthInfoWriter) (*PostLeasesAuthCreated, error) + PostLeases(params *PostLeasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLeasesCreated, error) - PostLeasesIDAuth(params *PostLeasesIDAuthParams, authInfo runtime.ClientAuthInfoWriter) (*PostLeasesIDAuthCreated, error) + PostLeasesIDAuth(params *PostLeasesIDAuthParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLeasesIDAuthCreated, error) - PutAccountsID(params *PutAccountsIDParams, authInfo runtime.ClientAuthInfoWriter) (*PutAccountsIDOK, error) + PutAccountsID(params *PutAccountsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAccountsIDOK, error) SetTransport(transport runtime.ClientTransport) } /* - DeleteAccountsID deletes an account by ID +DeleteAccountsID deletes an account by ID */ -func (a *Client) DeleteAccountsID(params *DeleteAccountsIDParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteAccountsIDNoContent, error) { +func (a *Client) DeleteAccountsID(params *DeleteAccountsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAccountsIDNoContent, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteAccountsIDParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "DeleteAccountsID", Method: "DELETE", PathPattern: "/accounts/{id}", @@ -81,7 +141,12 @@ func (a *Client) DeleteAccountsID(params *DeleteAccountsIDParams, authInfo runti AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -96,15 +161,14 @@ func (a *Client) DeleteAccountsID(params *DeleteAccountsIDParams, authInfo runti } /* - DeleteLeases removes a lease +DeleteLeases removes a lease */ -func (a *Client) DeleteLeases(params *DeleteLeasesParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteLeasesOK, error) { +func (a *Client) DeleteLeases(params *DeleteLeasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteLeasesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteLeasesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "DeleteLeases", Method: "DELETE", PathPattern: "/leases", @@ -116,7 +180,12 @@ func (a *Client) DeleteLeases(params *DeleteLeasesParams, authInfo runtime.Clien AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -131,15 +200,14 @@ func (a *Client) DeleteLeases(params *DeleteLeasesParams, authInfo runtime.Clien } /* - DeleteLeasesID deletes a lease by ID +DeleteLeasesID deletes a lease by ID */ -func (a *Client) DeleteLeasesID(params *DeleteLeasesIDParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteLeasesIDOK, error) { +func (a *Client) DeleteLeasesID(params *DeleteLeasesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteLeasesIDOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDeleteLeasesIDParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "DeleteLeasesID", Method: "DELETE", PathPattern: "/leases/{id}", @@ -151,7 +219,12 @@ func (a *Client) DeleteLeasesID(params *DeleteLeasesIDParams, authInfo runtime.C AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -166,15 +239,14 @@ func (a *Client) DeleteLeasesID(params *DeleteLeasesIDParams, authInfo runtime.C } /* - GetAccounts gets accounts +GetAccounts gets accounts */ -func (a *Client) GetAccounts(params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountsOK, error) { +func (a *Client) GetAccounts(params *GetAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetAccountsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetAccounts", Method: "GET", PathPattern: "/accounts", @@ -186,7 +258,12 @@ func (a *Client) GetAccounts(params *GetAccountsParams, authInfo runtime.ClientA AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -201,15 +278,14 @@ func (a *Client) GetAccounts(params *GetAccountsParams, authInfo runtime.ClientA } /* - GetAccountsID gets a specific account by an account ID +GetAccountsID gets a specific account by an account ID */ -func (a *Client) GetAccountsID(params *GetAccountsIDParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountsIDOK, error) { +func (a *Client) GetAccountsID(params *GetAccountsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAccountsIDOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetAccountsIDParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetAccountsID", Method: "GET", PathPattern: "/accounts/{id}", @@ -221,7 +297,12 @@ func (a *Client) GetAccountsID(params *GetAccountsIDParams, authInfo runtime.Cli AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -236,15 +317,14 @@ func (a *Client) GetAccountsID(params *GetAccountsIDParams, authInfo runtime.Cli } /* - GetAuth gets the d c e system authentication web page +GetAuth gets the d c e system authentication web page */ -func (a *Client) GetAuth(params *GetAuthParams) (*GetAuthOK, error) { +func (a *Client) GetAuth(params *GetAuthParams, opts ...ClientOption) (*GetAuthOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetAuthParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetAuth", Method: "GET", PathPattern: "/auth", @@ -255,7 +335,12 @@ func (a *Client) GetAuth(params *GetAuthParams) (*GetAuthOK, error) { Reader: &GetAuthReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -270,26 +355,30 @@ func (a *Client) GetAuth(params *GetAuthParams) (*GetAuthOK, error) { } /* - GetAuthFile gets the d c e system authentication web page static assets +GetAuthFile gets the d c e system authentication web page static assets */ -func (a *Client) GetAuthFile(params *GetAuthFileParams) (*GetAuthFileOK, error) { +func (a *Client) GetAuthFile(params *GetAuthFileParams, opts ...ClientOption) (*GetAuthFileOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetAuthFileParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetAuthFile", Method: "GET", PathPattern: "/auth/{file+}", - ProducesMediaTypes: []string{"text/css", "text/html", "text/javascript"}, + ProducesMediaTypes: []string{"text/html", "text/javascript", "text/css"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"https"}, Params: params, Reader: &GetAuthFileReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -304,15 +393,14 @@ func (a *Client) GetAuthFile(params *GetAuthFileParams) (*GetAuthFileOK, error) } /* - GetLeases gets leases +GetLeases gets leases */ -func (a *Client) GetLeases(params *GetLeasesParams, authInfo runtime.ClientAuthInfoWriter) (*GetLeasesOK, error) { +func (a *Client) GetLeases(params *GetLeasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLeasesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetLeasesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetLeases", Method: "GET", PathPattern: "/leases", @@ -324,7 +412,12 @@ func (a *Client) GetLeases(params *GetLeasesParams, authInfo runtime.ClientAuthI AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -339,15 +432,14 @@ func (a *Client) GetLeases(params *GetLeasesParams, authInfo runtime.ClientAuthI } /* - GetLeasesID gets a lease by Id +GetLeasesID gets a lease by Id */ -func (a *Client) GetLeasesID(params *GetLeasesIDParams, authInfo runtime.ClientAuthInfoWriter) (*GetLeasesIDOK, error) { +func (a *Client) GetLeasesID(params *GetLeasesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLeasesIDOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetLeasesIDParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetLeasesID", Method: "GET", PathPattern: "/leases/{id}", @@ -359,7 +451,12 @@ func (a *Client) GetLeasesID(params *GetLeasesIDParams, authInfo runtime.ClientA AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -374,15 +471,14 @@ func (a *Client) GetLeasesID(params *GetLeasesIDParams, authInfo runtime.ClientA } /* - GetUsage gets usage records by date range +GetUsage gets usage records by date range */ -func (a *Client) GetUsage(params *GetUsageParams, authInfo runtime.ClientAuthInfoWriter) (*GetUsageOK, error) { +func (a *Client) GetUsage(params *GetUsageParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUsageOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetUsageParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetUsage", Method: "GET", PathPattern: "/usage", @@ -394,7 +490,12 @@ func (a *Client) GetUsage(params *GetUsageParams, authInfo runtime.ClientAuthInf AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -409,15 +510,14 @@ func (a *Client) GetUsage(params *GetUsageParams, authInfo runtime.ClientAuthInf } /* - PostAccounts adds an a w s account to the account pool +PostAccounts adds an a w s account to the account pool */ -func (a *Client) PostAccounts(params *PostAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PostAccountsCreated, error) { +func (a *Client) PostAccounts(params *PostAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAccountsCreated, error) { // TODO: Validate the params before sending if params == nil { params = NewPostAccountsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "PostAccounts", Method: "POST", PathPattern: "/accounts", @@ -429,7 +529,12 @@ func (a *Client) PostAccounts(params *PostAccountsParams, authInfo runtime.Clien AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -444,15 +549,14 @@ func (a *Client) PostAccounts(params *PostAccountsParams, authInfo runtime.Clien } /* - PostLeases creates a new lease +PostLeases creates a new lease */ -func (a *Client) PostLeases(params *PostLeasesParams, authInfo runtime.ClientAuthInfoWriter) (*PostLeasesCreated, error) { +func (a *Client) PostLeases(params *PostLeasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLeasesCreated, error) { // TODO: Validate the params before sending if params == nil { params = NewPostLeasesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "PostLeases", Method: "POST", PathPattern: "/leases", @@ -464,65 +568,34 @@ func (a *Client) PostLeases(params *PostLeasesParams, authInfo runtime.ClientAut AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - success, ok := result.(*PostLeasesCreated) - if ok { - return success, nil } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PostLeases: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* - PostLeasesAuth creates lease authentication by for the requesting user s active lease -*/ -func (a *Client) PostLeasesAuth(params *PostLeasesAuthParams, authInfo runtime.ClientAuthInfoWriter) (*PostLeasesAuthCreated, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPostLeasesAuthParams() + for _, opt := range opts { + opt(op) } - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "PostLeasesAuth", - Method: "POST", - PathPattern: "/leases/auth", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"https"}, - Params: params, - Reader: &PostLeasesAuthReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) + result, err := a.transport.Submit(op) if err != nil { return nil, err } - success, ok := result.(*PostLeasesAuthCreated) + success, ok := result.(*PostLeasesCreated) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PostLeasesAuth: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for PostLeases: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } /* - PostLeasesIDAuth creates lease authentication by Id +PostLeasesIDAuth creates lease authentication by Id */ -func (a *Client) PostLeasesIDAuth(params *PostLeasesIDAuthParams, authInfo runtime.ClientAuthInfoWriter) (*PostLeasesIDAuthCreated, error) { +func (a *Client) PostLeasesIDAuth(params *PostLeasesIDAuthParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostLeasesIDAuthCreated, error) { // TODO: Validate the params before sending if params == nil { params = NewPostLeasesIDAuthParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "PostLeasesIDAuth", Method: "POST", PathPattern: "/leases/{id}/auth", @@ -534,7 +607,12 @@ func (a *Client) PostLeasesIDAuth(params *PostLeasesIDAuthParams, authInfo runti AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } @@ -549,15 +627,14 @@ func (a *Client) PostLeasesIDAuth(params *PostLeasesIDAuthParams, authInfo runti } /* - PutAccountsID updates an account +PutAccountsID updates an account */ -func (a *Client) PutAccountsID(params *PutAccountsIDParams, authInfo runtime.ClientAuthInfoWriter) (*PutAccountsIDOK, error) { +func (a *Client) PutAccountsID(params *PutAccountsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PutAccountsIDOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPutAccountsIDParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "PutAccountsID", Method: "PUT", PathPattern: "/accounts/{id}", @@ -569,7 +646,12 @@ func (a *Client) PutAccountsID(params *PutAccountsIDParams, authInfo runtime.Cli AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } diff --git a/client/operations/post_accounts_parameters.go b/client/operations/post_accounts_parameters.go index ce9a2e4..9fb719d 100644 --- a/client/operations/post_accounts_parameters.go +++ b/client/operations/post_accounts_parameters.go @@ -13,57 +13,57 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPostAccountsParams creates a new PostAccountsParams object -// with the default values initialized. +// NewPostAccountsParams creates a new PostAccountsParams 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 NewPostAccountsParams() *PostAccountsParams { - var () return &PostAccountsParams{ - timeout: cr.DefaultTimeout, } } // NewPostAccountsParamsWithTimeout creates a new PostAccountsParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostAccountsParamsWithTimeout(timeout time.Duration) *PostAccountsParams { - var () return &PostAccountsParams{ - timeout: timeout, } } // NewPostAccountsParamsWithContext creates a new PostAccountsParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostAccountsParamsWithContext(ctx context.Context) *PostAccountsParams { - var () return &PostAccountsParams{ - Context: ctx, } } // NewPostAccountsParamsWithHTTPClient creates a new PostAccountsParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostAccountsParamsWithHTTPClient(client *http.Client) *PostAccountsParams { - var () return &PostAccountsParams{ HTTPClient: client, } } -/*PostAccountsParams contains all the parameters to send to the API endpoint -for the post accounts operation typically these are written to a http.Request +/* +PostAccountsParams contains all the parameters to send to the API endpoint + + for the post accounts operation. + + Typically these are written to a http.Request. */ type PostAccountsParams struct { - /*Account - Account creation parameters + /* Account. + Account creation parameters */ Account PostAccountsBody @@ -72,6 +72,21 @@ type PostAccountsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAccountsParams) WithDefaults() *PostAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post accounts params func (o *PostAccountsParams) WithTimeout(timeout time.Duration) *PostAccountsParams { o.SetTimeout(timeout) @@ -123,7 +138,6 @@ func (o *PostAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } var res []error - if err := r.SetBodyParam(o.Account); err != nil { return err } diff --git a/client/operations/post_accounts_responses.go b/client/operations/post_accounts_responses.go index 3b761db..7da8c01 100644 --- a/client/operations/post_accounts_responses.go +++ b/client/operations/post_accounts_responses.go @@ -6,14 +6,14 @@ package operations // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "fmt" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - strfmt "github.com/go-openapi/strfmt" ) // PostAccountsReader is a Reader for the PostAccounts structure. @@ -36,9 +36,8 @@ func (o *PostAccountsReader) ReadResponse(response runtime.ClientResponse, consu return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[POST /accounts] PostAccounts", response, response.Code()) } } @@ -47,32 +46,77 @@ func NewPostAccountsCreated() *PostAccountsCreated { return &PostAccountsCreated{} } -/*PostAccountsCreated handles this case with default header values. +/* +PostAccountsCreated describes a response with status code 201, with default header values. Account Details */ type PostAccountsCreated struct { AccessControlAllowHeaders string - AccessControlAllowMethods string + AccessControlAllowOrigin string +} + +// IsSuccess returns true when this post accounts created response has a 2xx status code +func (o *PostAccountsCreated) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post accounts created response has a 3xx status code +func (o *PostAccountsCreated) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post accounts created response has a 4xx status code +func (o *PostAccountsCreated) IsClientError() bool { + return false +} - AccessControlAllowOrigin string +// IsServerError returns true when this post accounts created response has a 5xx status code +func (o *PostAccountsCreated) IsServerError() bool { + return false +} + +// IsCode returns true when this post accounts created response a status code equal to that given +func (o *PostAccountsCreated) IsCode(code int) bool { + return code == 201 +} + +// Code gets the status code for the post accounts created response +func (o *PostAccountsCreated) Code() int { + return 201 } func (o *PostAccountsCreated) Error() string { - return fmt.Sprintf("[POST /accounts][%d] postAccountsCreated ", 201) + return fmt.Sprintf("[POST /accounts][%d] postAccountsCreated", 201) +} + +func (o *PostAccountsCreated) String() string { + return fmt.Sprintf("[POST /accounts][%d] postAccountsCreated", 201) } func (o *PostAccountsCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") + + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") + + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } return nil } @@ -82,15 +126,50 @@ func NewPostAccountsForbidden() *PostAccountsForbidden { return &PostAccountsForbidden{} } -/*PostAccountsForbidden handles this case with default header values. +/* +PostAccountsForbidden describes a response with status code 403, with default header values. Failed to authenticate request */ type PostAccountsForbidden struct { } +// IsSuccess returns true when this post accounts forbidden response has a 2xx status code +func (o *PostAccountsForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this post accounts forbidden response has a 3xx status code +func (o *PostAccountsForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post accounts forbidden response has a 4xx status code +func (o *PostAccountsForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this post accounts forbidden response has a 5xx status code +func (o *PostAccountsForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this post accounts forbidden response a status code equal to that given +func (o *PostAccountsForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the post accounts forbidden response +func (o *PostAccountsForbidden) Code() int { + return 403 +} + func (o *PostAccountsForbidden) Error() string { - return fmt.Sprintf("[POST /accounts][%d] postAccountsForbidden ", 403) + return fmt.Sprintf("[POST /accounts][%d] postAccountsForbidden", 403) +} + +func (o *PostAccountsForbidden) String() string { + return fmt.Sprintf("[POST /accounts][%d] postAccountsForbidden", 403) } func (o *PostAccountsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -98,7 +177,8 @@ func (o *PostAccountsForbidden) readResponse(response runtime.ClientResponse, co return nil } -/*PostAccountsBody post accounts body +/* +PostAccountsBody post accounts body swagger:model PostAccountsBody */ type PostAccountsBody struct { @@ -152,6 +232,11 @@ func (o *PostAccountsBody) validateID(formats strfmt.Registry) error { return nil } +// ContextValidate validates this post accounts body based on context it is used +func (o *PostAccountsBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *PostAccountsBody) MarshalBinary() ([]byte, error) { if o == nil { diff --git a/client/operations/post_leases_auth_parameters.go b/client/operations/post_leases_auth_parameters.go deleted file mode 100644 index 53a6ff5..0000000 --- a/client/operations/post_leases_auth_parameters.go +++ /dev/null @@ -1,113 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package operations - -// 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" - - strfmt "github.com/go-openapi/strfmt" -) - -// NewPostLeasesAuthParams creates a new PostLeasesAuthParams object -// with the default values initialized. -func NewPostLeasesAuthParams() *PostLeasesAuthParams { - - return &PostLeasesAuthParams{ - - timeout: cr.DefaultTimeout, - } -} - -// NewPostLeasesAuthParamsWithTimeout creates a new PostLeasesAuthParams object -// with the default values initialized, and the ability to set a timeout on a request -func NewPostLeasesAuthParamsWithTimeout(timeout time.Duration) *PostLeasesAuthParams { - - return &PostLeasesAuthParams{ - - timeout: timeout, - } -} - -// NewPostLeasesAuthParamsWithContext creates a new PostLeasesAuthParams object -// with the default values initialized, and the ability to set a context for a request -func NewPostLeasesAuthParamsWithContext(ctx context.Context) *PostLeasesAuthParams { - - return &PostLeasesAuthParams{ - - Context: ctx, - } -} - -// NewPostLeasesAuthParamsWithHTTPClient creates a new PostLeasesAuthParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request -func NewPostLeasesAuthParamsWithHTTPClient(client *http.Client) *PostLeasesAuthParams { - - return &PostLeasesAuthParams{ - HTTPClient: client, - } -} - -/*PostLeasesAuthParams contains all the parameters to send to the API endpoint -for the post leases auth operation typically these are written to a http.Request -*/ -type PostLeasesAuthParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithTimeout adds the timeout to the post leases auth params -func (o *PostLeasesAuthParams) WithTimeout(timeout time.Duration) *PostLeasesAuthParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the post leases auth params -func (o *PostLeasesAuthParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the post leases auth params -func (o *PostLeasesAuthParams) WithContext(ctx context.Context) *PostLeasesAuthParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the post leases auth params -func (o *PostLeasesAuthParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the post leases auth params -func (o *PostLeasesAuthParams) WithHTTPClient(client *http.Client) *PostLeasesAuthParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the post leases auth params -func (o *PostLeasesAuthParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *PostLeasesAuthParams) 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/client/operations/post_leases_auth_responses.go b/client/operations/post_leases_auth_responses.go deleted file mode 100644 index 9ad1149..0000000 --- a/client/operations/post_leases_auth_responses.go +++ /dev/null @@ -1,236 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package operations - -// 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/swag" - - strfmt "github.com/go-openapi/strfmt" -) - -// PostLeasesAuthReader is a Reader for the PostLeasesAuth structure. -type PostLeasesAuthReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *PostLeasesAuthReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 201: - result := NewPostLeasesAuthCreated() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 401: - result := NewPostLeasesAuthUnauthorized() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 403: - result := NewPostLeasesAuthForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 404: - result := NewPostLeasesAuthNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewPostLeasesAuthInternalServerError() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) - } -} - -// NewPostLeasesAuthCreated creates a PostLeasesAuthCreated with default headers values -func NewPostLeasesAuthCreated() *PostLeasesAuthCreated { - return &PostLeasesAuthCreated{} -} - -/*PostLeasesAuthCreated handles this case with default header values. - -PostLeasesAuthCreated post leases auth created -*/ -type PostLeasesAuthCreated struct { - AccessControlAllowHeaders string - - AccessControlAllowMethods string - - AccessControlAllowOrigin string - - Payload *PostLeasesAuthCreatedBody -} - -func (o *PostLeasesAuthCreated) Error() string { - return fmt.Sprintf("[POST /leases/auth][%d] postLeasesAuthCreated %+v", 201, o.Payload) -} - -func (o *PostLeasesAuthCreated) GetPayload() *PostLeasesAuthCreatedBody { - return o.Payload -} - -func (o *PostLeasesAuthCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") - - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") - - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") - - o.Payload = new(PostLeasesAuthCreatedBody) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewPostLeasesAuthUnauthorized creates a PostLeasesAuthUnauthorized with default headers values -func NewPostLeasesAuthUnauthorized() *PostLeasesAuthUnauthorized { - return &PostLeasesAuthUnauthorized{} -} - -/*PostLeasesAuthUnauthorized handles this case with default header values. - -Unauthorized -*/ -type PostLeasesAuthUnauthorized struct { -} - -func (o *PostLeasesAuthUnauthorized) Error() string { - return fmt.Sprintf("[POST /leases/auth][%d] postLeasesAuthUnauthorized ", 401) -} - -func (o *PostLeasesAuthUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPostLeasesAuthForbidden creates a PostLeasesAuthForbidden with default headers values -func NewPostLeasesAuthForbidden() *PostLeasesAuthForbidden { - return &PostLeasesAuthForbidden{} -} - -/*PostLeasesAuthForbidden handles this case with default header values. - -Failed to retrieve lease authentication -*/ -type PostLeasesAuthForbidden struct { -} - -func (o *PostLeasesAuthForbidden) Error() string { - return fmt.Sprintf("[POST /leases/auth][%d] postLeasesAuthForbidden ", 403) -} - -func (o *PostLeasesAuthForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPostLeasesAuthNotFound creates a PostLeasesAuthNotFound with default headers values -func NewPostLeasesAuthNotFound() *PostLeasesAuthNotFound { - return &PostLeasesAuthNotFound{} -} - -/*PostLeasesAuthNotFound handles this case with default header values. - -No active lease exists for the requesting user -*/ -type PostLeasesAuthNotFound struct { -} - -func (o *PostLeasesAuthNotFound) Error() string { - return fmt.Sprintf("[POST /leases/auth][%d] postLeasesAuthNotFound ", 404) -} - -func (o *PostLeasesAuthNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewPostLeasesAuthInternalServerError creates a PostLeasesAuthInternalServerError with default headers values -func NewPostLeasesAuthInternalServerError() *PostLeasesAuthInternalServerError { - return &PostLeasesAuthInternalServerError{} -} - -/*PostLeasesAuthInternalServerError handles this case with default header values. - -Server failure -*/ -type PostLeasesAuthInternalServerError struct { -} - -func (o *PostLeasesAuthInternalServerError) Error() string { - return fmt.Sprintf("[POST /leases/auth][%d] postLeasesAuthInternalServerError ", 500) -} - -func (o *PostLeasesAuthInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -/*PostLeasesAuthCreatedBody Lease Authentication -swagger:model PostLeasesAuthCreatedBody -*/ -type PostLeasesAuthCreatedBody struct { - - // Access Key ID for access to the AWS API - AccessKeyID string `json:"accessKeyId,omitempty"` - - // URL to access the AWS Console - ConsoleURL string `json:"consoleUrl,omitempty"` - - // expires on - ExpiresOn float64 `json:"expiresOn,omitempty"` - - // Secret Access Key for access to the AWS API - SecretAccessKey string `json:"secretAccessKey,omitempty"` - - // Session Token for access to the AWS API - SessionToken string `json:"sessionToken,omitempty"` -} - -// Validate validates this post leases auth created body -func (o *PostLeasesAuthCreatedBody) Validate(formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *PostLeasesAuthCreatedBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *PostLeasesAuthCreatedBody) UnmarshalBinary(b []byte) error { - var res PostLeasesAuthCreatedBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/client/operations/post_leases_id_auth_parameters.go b/client/operations/post_leases_id_auth_parameters.go index b774305..6d3b218 100644 --- a/client/operations/post_leases_id_auth_parameters.go +++ b/client/operations/post_leases_id_auth_parameters.go @@ -13,57 +13,57 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPostLeasesIDAuthParams creates a new PostLeasesIDAuthParams object -// with the default values initialized. +// NewPostLeasesIDAuthParams creates a new PostLeasesIDAuthParams 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 NewPostLeasesIDAuthParams() *PostLeasesIDAuthParams { - var () return &PostLeasesIDAuthParams{ - timeout: cr.DefaultTimeout, } } // NewPostLeasesIDAuthParamsWithTimeout creates a new PostLeasesIDAuthParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostLeasesIDAuthParamsWithTimeout(timeout time.Duration) *PostLeasesIDAuthParams { - var () return &PostLeasesIDAuthParams{ - timeout: timeout, } } // NewPostLeasesIDAuthParamsWithContext creates a new PostLeasesIDAuthParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostLeasesIDAuthParamsWithContext(ctx context.Context) *PostLeasesIDAuthParams { - var () return &PostLeasesIDAuthParams{ - Context: ctx, } } // NewPostLeasesIDAuthParamsWithHTTPClient creates a new PostLeasesIDAuthParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostLeasesIDAuthParamsWithHTTPClient(client *http.Client) *PostLeasesIDAuthParams { - var () return &PostLeasesIDAuthParams{ HTTPClient: client, } } -/*PostLeasesIDAuthParams contains all the parameters to send to the API endpoint -for the post leases ID auth operation typically these are written to a http.Request +/* +PostLeasesIDAuthParams contains all the parameters to send to the API endpoint + + for the post leases ID auth operation. + + Typically these are written to a http.Request. */ type PostLeasesIDAuthParams struct { - /*ID - Id for lease + /* ID. + Id for lease */ ID string @@ -72,6 +72,21 @@ type PostLeasesIDAuthParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post leases ID auth params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostLeasesIDAuthParams) WithDefaults() *PostLeasesIDAuthParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post leases ID auth params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostLeasesIDAuthParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post leases ID auth params func (o *PostLeasesIDAuthParams) WithTimeout(timeout time.Duration) *PostLeasesIDAuthParams { o.SetTimeout(timeout) diff --git a/client/operations/post_leases_id_auth_responses.go b/client/operations/post_leases_id_auth_responses.go index 068ad3d..0101d61 100644 --- a/client/operations/post_leases_id_auth_responses.go +++ b/client/operations/post_leases_id_auth_responses.go @@ -6,13 +6,14 @@ package operations // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "encoding/json" "fmt" "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - - strfmt "github.com/go-openapi/strfmt" ) // PostLeasesIDAuthReader is a Reader for the PostLeasesIDAuth structure. @@ -47,9 +48,8 @@ func (o *PostLeasesIDAuthReader) ReadResponse(response runtime.ClientResponse, c return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[POST /leases/{id}/auth] PostLeasesIDAuth", response, response.Code()) } } @@ -58,22 +58,57 @@ func NewPostLeasesIDAuthCreated() *PostLeasesIDAuthCreated { return &PostLeasesIDAuthCreated{} } -/*PostLeasesIDAuthCreated handles this case with default header values. +/* +PostLeasesIDAuthCreated describes a response with status code 201, with default header values. PostLeasesIDAuthCreated post leases Id auth created */ type PostLeasesIDAuthCreated struct { AccessControlAllowHeaders string - AccessControlAllowMethods string - - AccessControlAllowOrigin string + AccessControlAllowOrigin string Payload *PostLeasesIDAuthCreatedBody } +// IsSuccess returns true when this post leases Id auth created response has a 2xx status code +func (o *PostLeasesIDAuthCreated) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post leases Id auth created response has a 3xx status code +func (o *PostLeasesIDAuthCreated) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post leases Id auth created response has a 4xx status code +func (o *PostLeasesIDAuthCreated) IsClientError() bool { + return false +} + +// IsServerError returns true when this post leases Id auth created response has a 5xx status code +func (o *PostLeasesIDAuthCreated) IsServerError() bool { + return false +} + +// IsCode returns true when this post leases Id auth created response a status code equal to that given +func (o *PostLeasesIDAuthCreated) IsCode(code int) bool { + return code == 201 +} + +// Code gets the status code for the post leases Id auth created response +func (o *PostLeasesIDAuthCreated) Code() int { + return 201 +} + func (o *PostLeasesIDAuthCreated) Error() string { - return fmt.Sprintf("[POST /leases/{id}/auth][%d] postLeasesIdAuthCreated %+v", 201, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /leases/{id}/auth][%d] postLeasesIdAuthCreated %s", 201, payload) +} + +func (o *PostLeasesIDAuthCreated) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /leases/{id}/auth][%d] postLeasesIdAuthCreated %s", 201, payload) } func (o *PostLeasesIDAuthCreated) GetPayload() *PostLeasesIDAuthCreatedBody { @@ -82,14 +117,26 @@ func (o *PostLeasesIDAuthCreated) GetPayload() *PostLeasesIDAuthCreatedBody { func (o *PostLeasesIDAuthCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } + + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } + + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(PostLeasesIDAuthCreatedBody) @@ -106,15 +153,50 @@ func NewPostLeasesIDAuthUnauthorized() *PostLeasesIDAuthUnauthorized { return &PostLeasesIDAuthUnauthorized{} } -/*PostLeasesIDAuthUnauthorized handles this case with default header values. +/* +PostLeasesIDAuthUnauthorized describes a response with status code 401, with default header values. Unauthorized */ type PostLeasesIDAuthUnauthorized struct { } +// IsSuccess returns true when this post leases Id auth unauthorized response has a 2xx status code +func (o *PostLeasesIDAuthUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this post leases Id auth unauthorized response has a 3xx status code +func (o *PostLeasesIDAuthUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post leases Id auth unauthorized response has a 4xx status code +func (o *PostLeasesIDAuthUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this post leases Id auth unauthorized response has a 5xx status code +func (o *PostLeasesIDAuthUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this post leases Id auth unauthorized response a status code equal to that given +func (o *PostLeasesIDAuthUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the post leases Id auth unauthorized response +func (o *PostLeasesIDAuthUnauthorized) Code() int { + return 401 +} + func (o *PostLeasesIDAuthUnauthorized) Error() string { - return fmt.Sprintf("[POST /leases/{id}/auth][%d] postLeasesIdAuthUnauthorized ", 401) + return fmt.Sprintf("[POST /leases/{id}/auth][%d] postLeasesIdAuthUnauthorized", 401) +} + +func (o *PostLeasesIDAuthUnauthorized) String() string { + return fmt.Sprintf("[POST /leases/{id}/auth][%d] postLeasesIdAuthUnauthorized", 401) } func (o *PostLeasesIDAuthUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -127,15 +209,50 @@ func NewPostLeasesIDAuthForbidden() *PostLeasesIDAuthForbidden { return &PostLeasesIDAuthForbidden{} } -/*PostLeasesIDAuthForbidden handles this case with default header values. +/* +PostLeasesIDAuthForbidden describes a response with status code 403, with default header values. Failed to retrieve lease authentication */ type PostLeasesIDAuthForbidden struct { } +// IsSuccess returns true when this post leases Id auth forbidden response has a 2xx status code +func (o *PostLeasesIDAuthForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this post leases Id auth forbidden response has a 3xx status code +func (o *PostLeasesIDAuthForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post leases Id auth forbidden response has a 4xx status code +func (o *PostLeasesIDAuthForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this post leases Id auth forbidden response has a 5xx status code +func (o *PostLeasesIDAuthForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this post leases Id auth forbidden response a status code equal to that given +func (o *PostLeasesIDAuthForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the post leases Id auth forbidden response +func (o *PostLeasesIDAuthForbidden) Code() int { + return 403 +} + func (o *PostLeasesIDAuthForbidden) Error() string { - return fmt.Sprintf("[POST /leases/{id}/auth][%d] postLeasesIdAuthForbidden ", 403) + return fmt.Sprintf("[POST /leases/{id}/auth][%d] postLeasesIdAuthForbidden", 403) +} + +func (o *PostLeasesIDAuthForbidden) String() string { + return fmt.Sprintf("[POST /leases/{id}/auth][%d] postLeasesIdAuthForbidden", 403) } func (o *PostLeasesIDAuthForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -148,15 +265,50 @@ func NewPostLeasesIDAuthInternalServerError() *PostLeasesIDAuthInternalServerErr return &PostLeasesIDAuthInternalServerError{} } -/*PostLeasesIDAuthInternalServerError handles this case with default header values. +/* +PostLeasesIDAuthInternalServerError describes a response with status code 500, with default header values. Server failure */ type PostLeasesIDAuthInternalServerError struct { } +// IsSuccess returns true when this post leases Id auth internal server error response has a 2xx status code +func (o *PostLeasesIDAuthInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this post leases Id auth internal server error response has a 3xx status code +func (o *PostLeasesIDAuthInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post leases Id auth internal server error response has a 4xx status code +func (o *PostLeasesIDAuthInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this post leases Id auth internal server error response has a 5xx status code +func (o *PostLeasesIDAuthInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this post leases Id auth internal server error response a status code equal to that given +func (o *PostLeasesIDAuthInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the post leases Id auth internal server error response +func (o *PostLeasesIDAuthInternalServerError) Code() int { + return 500 +} + func (o *PostLeasesIDAuthInternalServerError) Error() string { - return fmt.Sprintf("[POST /leases/{id}/auth][%d] postLeasesIdAuthInternalServerError ", 500) + return fmt.Sprintf("[POST /leases/{id}/auth][%d] postLeasesIdAuthInternalServerError", 500) +} + +func (o *PostLeasesIDAuthInternalServerError) String() string { + return fmt.Sprintf("[POST /leases/{id}/auth][%d] postLeasesIdAuthInternalServerError", 500) } func (o *PostLeasesIDAuthInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +316,8 @@ func (o *PostLeasesIDAuthInternalServerError) readResponse(response runtime.Clie return nil } -/*PostLeasesIDAuthCreatedBody Lease Authentication +/* +PostLeasesIDAuthCreatedBody Lease Authentication swagger:model PostLeasesIDAuthCreatedBody */ type PostLeasesIDAuthCreatedBody struct { @@ -175,9 +328,6 @@ type PostLeasesIDAuthCreatedBody struct { // URL to access the AWS Console ConsoleURL string `json:"consoleUrl,omitempty"` - // expires on - ExpiresOn float64 `json:"expiresOn,omitempty"` - // Secret Access Key for access to the AWS API SecretAccessKey string `json:"secretAccessKey,omitempty"` @@ -190,6 +340,11 @@ func (o *PostLeasesIDAuthCreatedBody) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this post leases ID auth created body based on context it is used +func (o *PostLeasesIDAuthCreatedBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *PostLeasesIDAuthCreatedBody) MarshalBinary() ([]byte, error) { if o == nil { diff --git a/client/operations/post_leases_parameters.go b/client/operations/post_leases_parameters.go index 94917a3..f14745d 100644 --- a/client/operations/post_leases_parameters.go +++ b/client/operations/post_leases_parameters.go @@ -13,57 +13,57 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPostLeasesParams creates a new PostLeasesParams object -// with the default values initialized. +// NewPostLeasesParams creates a new PostLeasesParams 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 NewPostLeasesParams() *PostLeasesParams { - var () return &PostLeasesParams{ - timeout: cr.DefaultTimeout, } } // NewPostLeasesParamsWithTimeout creates a new PostLeasesParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostLeasesParamsWithTimeout(timeout time.Duration) *PostLeasesParams { - var () return &PostLeasesParams{ - timeout: timeout, } } // NewPostLeasesParamsWithContext creates a new PostLeasesParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostLeasesParamsWithContext(ctx context.Context) *PostLeasesParams { - var () return &PostLeasesParams{ - Context: ctx, } } // NewPostLeasesParamsWithHTTPClient creates a new PostLeasesParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostLeasesParamsWithHTTPClient(client *http.Client) *PostLeasesParams { - var () return &PostLeasesParams{ HTTPClient: client, } } -/*PostLeasesParams contains all the parameters to send to the API endpoint -for the post leases operation typically these are written to a http.Request +/* +PostLeasesParams contains all the parameters to send to the API endpoint + + for the post leases operation. + + Typically these are written to a http.Request. */ type PostLeasesParams struct { - /*Lease - The owner of the lease + /* Lease. + The owner of the lease */ Lease PostLeasesBody @@ -72,6 +72,21 @@ type PostLeasesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post leases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostLeasesParams) WithDefaults() *PostLeasesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post leases params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostLeasesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post leases params func (o *PostLeasesParams) WithTimeout(timeout time.Duration) *PostLeasesParams { o.SetTimeout(timeout) @@ -123,7 +138,6 @@ func (o *PostLeasesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re return err } var res []error - if err := r.SetBodyParam(o.Lease); err != nil { return err } diff --git a/client/operations/post_leases_responses.go b/client/operations/post_leases_responses.go index 90b5795..f309372 100644 --- a/client/operations/post_leases_responses.go +++ b/client/operations/post_leases_responses.go @@ -6,16 +6,16 @@ package operations // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "fmt" "io" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - strfmt "github.com/go-openapi/strfmt" ) // PostLeasesReader is a Reader for the PostLeases structure. @@ -56,9 +56,8 @@ func (o *PostLeasesReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[POST /leases] PostLeases", response, response.Code()) } } @@ -67,22 +66,57 @@ func NewPostLeasesCreated() *PostLeasesCreated { return &PostLeasesCreated{} } -/*PostLeasesCreated handles this case with default header values. +/* +PostLeasesCreated describes a response with status code 201, with default header values. PostLeasesCreated post leases created */ type PostLeasesCreated struct { AccessControlAllowHeaders string - AccessControlAllowMethods string - - AccessControlAllowOrigin string + AccessControlAllowOrigin string Payload *PostLeasesCreatedBody } +// IsSuccess returns true when this post leases created response has a 2xx status code +func (o *PostLeasesCreated) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post leases created response has a 3xx status code +func (o *PostLeasesCreated) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post leases created response has a 4xx status code +func (o *PostLeasesCreated) IsClientError() bool { + return false +} + +// IsServerError returns true when this post leases created response has a 5xx status code +func (o *PostLeasesCreated) IsServerError() bool { + return false +} + +// IsCode returns true when this post leases created response a status code equal to that given +func (o *PostLeasesCreated) IsCode(code int) bool { + return code == 201 +} + +// Code gets the status code for the post leases created response +func (o *PostLeasesCreated) Code() int { + return 201 +} + func (o *PostLeasesCreated) Error() string { - return fmt.Sprintf("[POST /leases][%d] postLeasesCreated %+v", 201, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /leases][%d] postLeasesCreated %s", 201, payload) +} + +func (o *PostLeasesCreated) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /leases][%d] postLeasesCreated %s", 201, payload) } func (o *PostLeasesCreated) GetPayload() *PostLeasesCreatedBody { @@ -91,14 +125,26 @@ func (o *PostLeasesCreated) GetPayload() *PostLeasesCreatedBody { func (o *PostLeasesCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } + + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } + + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } o.Payload = new(PostLeasesCreatedBody) @@ -115,16 +161,50 @@ func NewPostLeasesBadRequest() *PostLeasesBadRequest { return &PostLeasesBadRequest{} } -/*PostLeasesBadRequest handles this case with default header values. +/* +PostLeasesBadRequest describes a response with status code 400, with default header values. If the "expiresOn" date specified is non-zero but less than the current epoch date, "Requested lease has a desired expiry date less than today: " or "Failed to Parse Request Body" if the request body is blank or incorrectly formatted. - */ type PostLeasesBadRequest struct { } +// IsSuccess returns true when this post leases bad request response has a 2xx status code +func (o *PostLeasesBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this post leases bad request response has a 3xx status code +func (o *PostLeasesBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post leases bad request response has a 4xx status code +func (o *PostLeasesBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this post leases bad request response has a 5xx status code +func (o *PostLeasesBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this post leases bad request response a status code equal to that given +func (o *PostLeasesBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the post leases bad request response +func (o *PostLeasesBadRequest) Code() int { + return 400 +} + func (o *PostLeasesBadRequest) Error() string { - return fmt.Sprintf("[POST /leases][%d] postLeasesBadRequest ", 400) + return fmt.Sprintf("[POST /leases][%d] postLeasesBadRequest", 400) +} + +func (o *PostLeasesBadRequest) String() string { + return fmt.Sprintf("[POST /leases][%d] postLeasesBadRequest", 400) } func (o *PostLeasesBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -137,15 +217,50 @@ func NewPostLeasesForbidden() *PostLeasesForbidden { return &PostLeasesForbidden{} } -/*PostLeasesForbidden handles this case with default header values. +/* +PostLeasesForbidden describes a response with status code 403, with default header values. Failed to authenticate request */ type PostLeasesForbidden struct { } +// IsSuccess returns true when this post leases forbidden response has a 2xx status code +func (o *PostLeasesForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this post leases forbidden response has a 3xx status code +func (o *PostLeasesForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post leases forbidden response has a 4xx status code +func (o *PostLeasesForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this post leases forbidden response has a 5xx status code +func (o *PostLeasesForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this post leases forbidden response a status code equal to that given +func (o *PostLeasesForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the post leases forbidden response +func (o *PostLeasesForbidden) Code() int { + return 403 +} + func (o *PostLeasesForbidden) Error() string { - return fmt.Sprintf("[POST /leases][%d] postLeasesForbidden ", 403) + return fmt.Sprintf("[POST /leases][%d] postLeasesForbidden", 403) +} + +func (o *PostLeasesForbidden) String() string { + return fmt.Sprintf("[POST /leases][%d] postLeasesForbidden", 403) } func (o *PostLeasesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -158,15 +273,50 @@ func NewPostLeasesConflict() *PostLeasesConflict { return &PostLeasesConflict{} } -/*PostLeasesConflict handles this case with default header values. +/* +PostLeasesConflict describes a response with status code 409, with default header values. Conflict if there is an existing lease already active with the provided principal and account. */ type PostLeasesConflict struct { } +// IsSuccess returns true when this post leases conflict response has a 2xx status code +func (o *PostLeasesConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this post leases conflict response has a 3xx status code +func (o *PostLeasesConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post leases conflict response has a 4xx status code +func (o *PostLeasesConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this post leases conflict response has a 5xx status code +func (o *PostLeasesConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this post leases conflict response a status code equal to that given +func (o *PostLeasesConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the post leases conflict response +func (o *PostLeasesConflict) Code() int { + return 409 +} + func (o *PostLeasesConflict) Error() string { - return fmt.Sprintf("[POST /leases][%d] postLeasesConflict ", 409) + return fmt.Sprintf("[POST /leases][%d] postLeasesConflict", 409) +} + +func (o *PostLeasesConflict) String() string { + return fmt.Sprintf("[POST /leases][%d] postLeasesConflict", 409) } func (o *PostLeasesConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -179,15 +329,50 @@ func NewPostLeasesInternalServerError() *PostLeasesInternalServerError { return &PostLeasesInternalServerError{} } -/*PostLeasesInternalServerError handles this case with default header values. +/* +PostLeasesInternalServerError describes a response with status code 500, with default header values. Server errors if the database cannot be reached. */ type PostLeasesInternalServerError struct { } +// IsSuccess returns true when this post leases internal server error response has a 2xx status code +func (o *PostLeasesInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this post leases internal server error response has a 3xx status code +func (o *PostLeasesInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post leases internal server error response has a 4xx status code +func (o *PostLeasesInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this post leases internal server error response has a 5xx status code +func (o *PostLeasesInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this post leases internal server error response a status code equal to that given +func (o *PostLeasesInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the post leases internal server error response +func (o *PostLeasesInternalServerError) Code() int { + return 500 +} + func (o *PostLeasesInternalServerError) Error() string { - return fmt.Sprintf("[POST /leases][%d] postLeasesInternalServerError ", 500) + return fmt.Sprintf("[POST /leases][%d] postLeasesInternalServerError", 500) +} + +func (o *PostLeasesInternalServerError) String() string { + return fmt.Sprintf("[POST /leases][%d] postLeasesInternalServerError", 500) } func (o *PostLeasesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -195,7 +380,8 @@ func (o *PostLeasesInternalServerError) readResponse(response runtime.ClientResp return nil } -/*PostLeasesBody post leases body +/* +PostLeasesBody post leases body swagger:model PostLeasesBody */ type PostLeasesBody struct { @@ -282,6 +468,11 @@ func (o *PostLeasesBody) validatePrincipalID(formats strfmt.Registry) error { return nil } +// ContextValidate validates this post leases body based on context it is used +func (o *PostLeasesBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *PostLeasesBody) MarshalBinary() ([]byte, error) { if o == nil { @@ -300,7 +491,8 @@ func (o *PostLeasesBody) UnmarshalBinary(b []byte) error { return nil } -/*PostLeasesCreatedBody Lease Details +/* +PostLeasesCreatedBody Lease Details swagger:model PostLeasesCreatedBody */ type PostLeasesCreatedBody struct { @@ -333,7 +525,7 @@ type PostLeasesCreatedBody struct { // "Active": The principal is leased and has access to the account // "Inactive": The lease has become inactive, either through expiring, exceeding budget, or by request. // - // Enum: [Active Inactive] + // Enum: ["Active","Inactive"] LeaseStatus string `json:"leaseStatus,omitempty"` // date lease status was last modified in epoch seconds @@ -350,7 +542,7 @@ type PostLeasesCreatedBody struct { // "LeaseRolledBack": A system error occurred while provisioning the lease. // and it was rolled back. // - // Enum: [LeaseExpired LeaseOverBudget LeaseDestroyed LeaseActive LeaseRolledBack] + // Enum: ["LeaseExpired","LeaseOverBudget","LeaseDestroyed","LeaseActive","LeaseRolledBack"] LeaseStatusReason string `json:"leaseStatusReason,omitempty"` // principalId of the lease to get @@ -398,14 +590,13 @@ const ( // prop value enum func (o *PostLeasesCreatedBody) validateLeaseStatusEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, postLeasesCreatedBodyTypeLeaseStatusPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, postLeasesCreatedBodyTypeLeaseStatusPropEnum, true); err != nil { return err } return nil } func (o *PostLeasesCreatedBody) validateLeaseStatus(formats strfmt.Registry) error { - if swag.IsZero(o.LeaseStatus) { // not required return nil } @@ -450,14 +641,13 @@ const ( // prop value enum func (o *PostLeasesCreatedBody) validateLeaseStatusReasonEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, postLeasesCreatedBodyTypeLeaseStatusReasonPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, postLeasesCreatedBodyTypeLeaseStatusReasonPropEnum, true); err != nil { return err } return nil } func (o *PostLeasesCreatedBody) validateLeaseStatusReason(formats strfmt.Registry) error { - if swag.IsZero(o.LeaseStatusReason) { // not required return nil } @@ -470,6 +660,11 @@ func (o *PostLeasesCreatedBody) validateLeaseStatusReason(formats strfmt.Registr return nil } +// ContextValidate validates this post leases created body based on context it is used +func (o *PostLeasesCreatedBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *PostLeasesCreatedBody) MarshalBinary() ([]byte, error) { if o == nil { diff --git a/client/operations/put_accounts_id_parameters.go b/client/operations/put_accounts_id_parameters.go index 525882e..82eb6e5 100644 --- a/client/operations/put_accounts_id_parameters.go +++ b/client/operations/put_accounts_id_parameters.go @@ -13,62 +13,63 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPutAccountsIDParams creates a new PutAccountsIDParams object -// with the default values initialized. +// NewPutAccountsIDParams creates a new PutAccountsIDParams 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 NewPutAccountsIDParams() *PutAccountsIDParams { - var () return &PutAccountsIDParams{ - timeout: cr.DefaultTimeout, } } // NewPutAccountsIDParamsWithTimeout creates a new PutAccountsIDParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPutAccountsIDParamsWithTimeout(timeout time.Duration) *PutAccountsIDParams { - var () return &PutAccountsIDParams{ - timeout: timeout, } } // NewPutAccountsIDParamsWithContext creates a new PutAccountsIDParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPutAccountsIDParamsWithContext(ctx context.Context) *PutAccountsIDParams { - var () return &PutAccountsIDParams{ - Context: ctx, } } // NewPutAccountsIDParamsWithHTTPClient creates a new PutAccountsIDParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPutAccountsIDParamsWithHTTPClient(client *http.Client) *PutAccountsIDParams { - var () return &PutAccountsIDParams{ HTTPClient: client, } } -/*PutAccountsIDParams contains all the parameters to send to the API endpoint -for the put accounts ID operation typically these are written to a http.Request +/* +PutAccountsIDParams contains all the parameters to send to the API endpoint + + for the put accounts ID operation. + + Typically these are written to a http.Request. */ type PutAccountsIDParams struct { - /*Account - Account parameters to modify + /* Account. + Account parameters to modify */ Account PutAccountsIDBody - /*ID - AWS Account ID + /* ID. + + AWS Account ID */ ID string @@ -77,6 +78,21 @@ type PutAccountsIDParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the put accounts ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutAccountsIDParams) WithDefaults() *PutAccountsIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the put accounts ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PutAccountsIDParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the put accounts ID params func (o *PutAccountsIDParams) WithTimeout(timeout time.Duration) *PutAccountsIDParams { o.SetTimeout(timeout) @@ -139,7 +155,6 @@ func (o *PutAccountsIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt return err } var res []error - if err := r.SetBodyParam(o.Account); err != nil { return err } diff --git a/client/operations/put_accounts_id_responses.go b/client/operations/put_accounts_id_responses.go index db41cd5..6ebeea6 100644 --- a/client/operations/put_accounts_id_responses.go +++ b/client/operations/put_accounts_id_responses.go @@ -6,12 +6,12 @@ package operations // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "fmt" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - - strfmt "github.com/go-openapi/strfmt" ) // PutAccountsIDReader is a Reader for the PutAccountsID structure. @@ -34,9 +34,8 @@ func (o *PutAccountsIDReader) ReadResponse(response runtime.ClientResponse, cons return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("[PUT /accounts/{id}] PutAccountsID", response, response.Code()) } } @@ -45,32 +44,77 @@ func NewPutAccountsIDOK() *PutAccountsIDOK { return &PutAccountsIDOK{} } -/*PutAccountsIDOK handles this case with default header values. +/* +PutAccountsIDOK describes a response with status code 200, with default header values. Account Details */ type PutAccountsIDOK struct { AccessControlAllowHeaders string - AccessControlAllowMethods string + AccessControlAllowOrigin string +} + +// IsSuccess returns true when this put accounts Id o k response has a 2xx status code +func (o *PutAccountsIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this put accounts Id o k response has a 3xx status code +func (o *PutAccountsIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this put accounts Id o k response has a 4xx status code +func (o *PutAccountsIDOK) IsClientError() bool { + return false +} - AccessControlAllowOrigin string +// IsServerError returns true when this put accounts Id o k response has a 5xx status code +func (o *PutAccountsIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this put accounts Id o k response a status code equal to that given +func (o *PutAccountsIDOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the put accounts Id o k response +func (o *PutAccountsIDOK) Code() int { + return 200 } func (o *PutAccountsIDOK) Error() string { - return fmt.Sprintf("[PUT /accounts/{id}][%d] putAccountsIdOK ", 200) + return fmt.Sprintf("[PUT /accounts/{id}][%d] putAccountsIdOK", 200) +} + +func (o *PutAccountsIDOK) String() string { + return fmt.Sprintf("[PUT /accounts/{id}][%d] putAccountsIdOK", 200) } func (o *PutAccountsIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - // response header Access-Control-Allow-Headers - o.AccessControlAllowHeaders = response.GetHeader("Access-Control-Allow-Headers") + // hydrates response header Access-Control-Allow-Headers + hdrAccessControlAllowHeaders := response.GetHeader("Access-Control-Allow-Headers") + + if hdrAccessControlAllowHeaders != "" { + o.AccessControlAllowHeaders = hdrAccessControlAllowHeaders + } - // response header Access-Control-Allow-Methods - o.AccessControlAllowMethods = response.GetHeader("Access-Control-Allow-Methods") + // hydrates response header Access-Control-Allow-Methods + hdrAccessControlAllowMethods := response.GetHeader("Access-Control-Allow-Methods") + + if hdrAccessControlAllowMethods != "" { + o.AccessControlAllowMethods = hdrAccessControlAllowMethods + } - // response header Access-Control-Allow-Origin - o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin") + // hydrates response header Access-Control-Allow-Origin + hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") + + if hdrAccessControlAllowOrigin != "" { + o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin + } return nil } @@ -80,15 +124,50 @@ func NewPutAccountsIDForbidden() *PutAccountsIDForbidden { return &PutAccountsIDForbidden{} } -/*PutAccountsIDForbidden handles this case with default header values. +/* +PutAccountsIDForbidden describes a response with status code 403, with default header values. Forbidden */ type PutAccountsIDForbidden struct { } +// IsSuccess returns true when this put accounts Id forbidden response has a 2xx status code +func (o *PutAccountsIDForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this put accounts Id forbidden response has a 3xx status code +func (o *PutAccountsIDForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this put accounts Id forbidden response has a 4xx status code +func (o *PutAccountsIDForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this put accounts Id forbidden response has a 5xx status code +func (o *PutAccountsIDForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this put accounts Id forbidden response a status code equal to that given +func (o *PutAccountsIDForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the put accounts Id forbidden response +func (o *PutAccountsIDForbidden) Code() int { + return 403 +} + func (o *PutAccountsIDForbidden) Error() string { - return fmt.Sprintf("[PUT /accounts/{id}][%d] putAccountsIdForbidden ", 403) + return fmt.Sprintf("[PUT /accounts/{id}][%d] putAccountsIdForbidden", 403) +} + +func (o *PutAccountsIDForbidden) String() string { + return fmt.Sprintf("[PUT /accounts/{id}][%d] putAccountsIdForbidden", 403) } func (o *PutAccountsIDForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -96,7 +175,8 @@ func (o *PutAccountsIDForbidden) readResponse(response runtime.ClientResponse, c return nil } -/*PutAccountsIDBody put accounts ID body +/* +PutAccountsIDBody put accounts ID body swagger:model PutAccountsIDBody */ type PutAccountsIDBody struct { @@ -114,6 +194,11 @@ func (o *PutAccountsIDBody) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this put accounts ID body based on context it is used +func (o *PutAccountsIDBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *PutAccountsIDBody) MarshalBinary() ([]byte, error) { if o == nil { diff --git a/cmd/leases.go b/cmd/leases.go index 12623ff..2e7066f 100644 --- a/cmd/leases.go +++ b/cmd/leases.go @@ -5,7 +5,7 @@ import ( "github.com/spf13/cobra" ) -//LeasesPath path to lease endpoint +// LeasesPath path to lease endpoint const LeasesPath = "/leases" var acctID string diff --git a/cmd/root.go b/cmd/root.go index 5bc8485..9c29657 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/cmd/system.go b/cmd/system.go index 0156d9c..d4e4d29 100644 --- a/cmd/system.go +++ b/cmd/system.go @@ -151,11 +151,11 @@ func stringp(s string) *string { } func getRandString(n int) string { - rand.Seed(time.Now().UnixNano()) + rand.New(rand.NewSource(time.Now().UnixNano())) //nolint:gosec const letterBytes = "abcdefghijklmnopqrstuvwxyz0123456789" b := make([]byte, n) for i := range b { - b[i] = letterBytes[rand.Int63()%int64(len(letterBytes))] + b[i] = letterBytes[rand.Int63()%int64(len(letterBytes))] //nolint:gosec } return string(b) } diff --git a/go.mod b/go.mod index 71ba558..a75caa2 100644 --- a/go.mod +++ b/go.mod @@ -24,24 +24,24 @@ require ( github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 // indirect github.com/dsnet/compress v0.0.1 // indirect github.com/frankban/quicktest v1.7.0 // indirect - github.com/go-openapi/errors v0.19.2 - github.com/go-openapi/runtime v0.19.7 - github.com/go-openapi/strfmt v0.19.3 - github.com/go-openapi/swag v0.19.5 - github.com/go-openapi/validate v0.19.3 - github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect + github.com/go-openapi/errors v0.22.0 + github.com/go-openapi/runtime v0.28.0 + github.com/go-openapi/strfmt v0.23.0 + github.com/go-openapi/swag v0.23.0 + github.com/go-openapi/validate v0.24.0 github.com/mholt/archiver v3.1.1+incompatible github.com/mitchellh/go-homedir v1.1.0 github.com/nwaples/rardecode v1.0.0 // indirect github.com/pierrec/lz4 v2.3.0+incompatible // indirect github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 github.com/pkg/errors v0.8.0 + github.com/rjeczalik/interfaces v0.3.0 // indirect github.com/sirupsen/logrus v1.2.0 github.com/spf13/cobra v0.0.5 - github.com/stretchr/testify v1.4.0 + github.com/stretchr/testify v1.9.0 github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect go.uber.org/thriftrw v1.20.2 - golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 // indirect - golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa // indirect - gopkg.in/yaml.v2 v2.2.4 + golang.org/x/net v0.28.0 // indirect + golang.org/x/sys v0.24.0 // indirect + gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index f0cf480..f3f75f7 100644 --- a/go.sum +++ b/go.sum @@ -1,13 +1,7 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= -github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= -github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= -github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= -github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA= -github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= +github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/aws/aws-sdk-go v1.25.16 h1:k7Fy6T/uNuLX6zuayU/TJoP7yMgGcJSkZpF7QVjwYpA= github.com/aws/aws-sdk-go v1.25.16/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= @@ -16,203 +10,246 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5O github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/coreos/etcd v3.3.10+incompatible h1:jFneRYjIvLMLhDLCzuTuU4rSJUjRplcJQ7pD7MnhC04= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dsnet/compress v0.0.1 h1:PlZu0n3Tuv04TzpfPbrnI0HW/YwodEXDS+oPKahKF0Q= github.com/dsnet/compress v0.0.1/go.mod h1:Aw8dCMJ7RioblQeTqt88akK31OvO8Dhf5JflhBbQEHo= github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY= github.com/frankban/quicktest v1.7.0 h1:dwIEggvZoS4J8ft6vgpnP000Z8DfcN/hMD3Cg+1Li0E= github.com/frankban/quicktest v1.7.0/go.mod h1:jaStnuzAqU1AJdCO0l53JDCJrVDKcS03DbaAcR7Ks/o= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= -github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= -github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= -github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= -github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= -github.com/go-openapi/analysis v0.19.2/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk= -github.com/go-openapi/analysis v0.19.4/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk= -github.com/go-openapi/analysis v0.19.5 h1:8b2ZgKfKIUTVQpTb77MoRDIMEIwvDVw40o3aOXdfYzI= -github.com/go-openapi/analysis v0.19.5/go.mod h1:hkEAkxagaIvIP7VTn8ygJNkd4kAYON2rCu0v0ObL0AU= -github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= -github.com/go-openapi/errors v0.18.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= -github.com/go-openapi/errors v0.19.2 h1:a2kIyV3w+OS3S97zxUndRVD46+FhGOUBDFY7nmu4CsY= -github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= -github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= -github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= -github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= -github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm72325Bq8FI3w= -github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= -github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= -github.com/go-openapi/jsonreference v0.19.2 h1:o20suLFB4Ri0tuzpWtyHlh7E7HnkqTNLq6aR6WVNS1w= -github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= -github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= -github.com/go-openapi/loads v0.18.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= -github.com/go-openapi/loads v0.19.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= -github.com/go-openapi/loads v0.19.2/go.mod h1:QAskZPMX5V0C2gvfkGZzJlINuP7Hx/4+ix5jWFxsNPs= -github.com/go-openapi/loads v0.19.3 h1:jwIoahqCmaA5OBoc/B+1+Mu2L0Gr8xYQnbeyQEo/7b0= -github.com/go-openapi/loads v0.19.3/go.mod h1:YVfqhUCdahYwR3f3iiwQLhicVRvLlU/WO5WPaZvcvSI= -github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9/go.mod h1:6v9a6LTXWQCdL8k1AO3cvqx5OtZY/Y9wKTgaoP6YRfA= -github.com/go-openapi/runtime v0.19.0/go.mod h1:OwNfisksmmaZse4+gpV3Ne9AyMOlP1lt4sK4FXt0O64= -github.com/go-openapi/runtime v0.19.4/go.mod h1:X277bwSUBxVlCYR3r7xgZZGKVvBd/29gLDlFGtJ8NL4= -github.com/go-openapi/runtime v0.19.7 h1:b2zcE9GCjDVtguugU7+S95vkHjwQEjz/lB+8LOuA9Nw= -github.com/go-openapi/runtime v0.19.7/go.mod h1:dhGWCTKRXlAfGnQG0ONViOZpjfg0m2gUt9nTQPQZuoo= -github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= -github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= -github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY= -github.com/go-openapi/spec v0.19.3 h1:0XRyw8kguri6Yw4SxhsQA/atC88yqrk0+G4YhI2wabc= -github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= -github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= -github.com/go-openapi/strfmt v0.18.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= -github.com/go-openapi/strfmt v0.19.0/go.mod h1:+uW+93UVvGGq2qGaZxdDeJqSAqBqBdl+ZPMF/cC8nDY= -github.com/go-openapi/strfmt v0.19.2/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= -github.com/go-openapi/strfmt v0.19.3 h1:eRfyY5SkaNJCAwmmMcADjY31ow9+N7MCLW7oRkbsINA= -github.com/go-openapi/strfmt v0.19.3/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= -github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= -github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= -github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= -github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= -github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= -github.com/go-openapi/validate v0.19.3 h1:PAH/2DylwWcIU1s0Y7k3yNmeAgWOcKrNE2Q7Ww/kCg4= -github.com/go-openapi/validate v0.19.3/go.mod h1:90Vh6jjkTn+OT1Eefm0ZixWNFjhtOH7vS9k0lo6zwJo= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-openapi/analysis v0.23.0 h1:aGday7OWupfMs+LbmLZG4k0MYXIANxcuBTYUC03zFCU= +github.com/go-openapi/analysis v0.23.0/go.mod h1:9mz9ZWaSlV8TvjQHLl2mUW2PbZtemkE8yA5v22ohupo= +github.com/go-openapi/errors v0.22.0 h1:c4xY/OLxUBSTiepAg3j/MHuAv5mJhnf53LLMWFB+u/w= +github.com/go-openapi/errors v0.22.0/go.mod h1:J3DmZScxCDufmIMsdOuDHxJbdOGC0xtUynjIx092vXE= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= +github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= +github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= +github.com/go-openapi/loads v0.22.0 h1:ECPGd4jX1U6NApCGG1We+uEozOAvXvJSF4nnwHZ8Aco= +github.com/go-openapi/loads v0.22.0/go.mod h1:yLsaTCS92mnSAZX5WWoxszLj0u+Ojl+Zs5Stn1oF+rs= +github.com/go-openapi/runtime v0.28.0 h1:gpPPmWSNGo214l6n8hzdXYhPuJcGtziTOgUpvsFWGIQ= +github.com/go-openapi/runtime v0.28.0/go.mod h1:QN7OzcS+XuYmkQLw05akXk0jRH/eZ3kb18+1KwW9gyc= +github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9ZY= +github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk= +github.com/go-openapi/strfmt v0.23.0 h1:nlUS6BCqcnAk0pyhi9Y+kdDVZdZMHfEKQiS4HaMgO/c= +github.com/go-openapi/strfmt v0.23.0/go.mod h1:NrtIpfKtWIygRkKVsxh7XQMDQW5HKQl6S5ik2elW+K4= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= +github.com/go-openapi/validate v0.24.0 h1:LdfDKwNbpB6Vn40xhTdNZAnfLECL81w+VX3BumrGD58= +github.com/go-openapi/validate v0.24.0/go.mod h1:iyeX1sEufmv3nPbBdX3ieNviWnOZaJ1+zquzJEf2BAQ= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e h1:hB2xlXdHp/pmPZq0y3QnmWAArdw9PqbmotexnWx/FU8= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mholt/archiver v3.1.1+incompatible h1:1dCVxuqs0dJseYEhi5pl7MYPH9zDa1wBi7mF09cbNkU= github.com/mholt/archiver v3.1.1+incompatible/go.mod h1:Dh2dOXnSdiLxRiPoVfIr/fI1TwETms9B8CTWfeh7ROU= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nwaples/rardecode v1.0.0 h1:r7vGuS5akxOnR4JQSkko62RJ1ReCMXxQRPtxsiFMBOs= github.com/nwaples/rardecode v1.0.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= -github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= +github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pierrec/lz4 v2.3.0+incompatible h1:CZzRn4Ut9GbUkHlQ7jqBXeZQV41ZSKWFc302ZU6lUTk= github.com/pierrec/lz4 v2.3.0+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rjeczalik/interfaces v0.3.0 h1:BM+eRAwfOcvW5qVhxv7x09x/0jwHN6z2GB9HsSA2weM= +github.com/rjeczalik/interfaces v0.3.0/go.mod h1:wfGcwiM/PXv9l6U/CPCb4Yh5KngED3dR3OppEVHMWuU= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.3.2 h1:VUFqw5KcqRf7i70GOzW7N+Q7+gxVBkSSqiXB12+JQ4M= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= -github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8 h1:3SVOIvH7Ae1KRYyQWRjXWJEA9sS/c/pjvH++55Gr648= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ulikunitz/xz v0.5.6 h1:jGHAfXawEGZQ3blwU5wnWKQJvAraT7Ftq9EXjnXYgt8= github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= +github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= -go.mongodb.org/mongo-driver v1.1.1 h1:Sq1fR+0c58RME5EoqKdjkiQAmPjmfHlZOoRI6fTUOcs= -go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80= +go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= +go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= +go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= +go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= +go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= +go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= +go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= +go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= +go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= go.uber.org/thriftrw v1.20.2 h1:0JlCE7dOyWHEQdfDm0MWIbgTn6vXkiMA6LNIe8FQXjw= go.uber.org/thriftrw v1.20.2/go.mod h1:a0+HZMaS9tmHDCPyrrx1GjYWFRK02xzxnrK1Nl9LiLU= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM= -golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa h1:KIDDMLT1O0Nr7TSxp8xM5tJcdn8tgyAONntO829og1M= -golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= +golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= +golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +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.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190501045030-23463209683d/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/constants/constants_unix.go b/internal/constants/constants_unix.go index cd1e40f..441bc86 100644 --- a/internal/constants/constants_unix.go +++ b/internal/constants/constants_unix.go @@ -1,7 +1,9 @@ +//go:build !windows // +build !windows package constants +//nolint:gosec const CredentialsExport string = `export AWS_ACCESS_KEY_ID=%s export AWS_SECRET_ACCESS_KEY=%s export AWS_SESSION_TOKEN=%s` diff --git a/internal/constants/constants_windows.go b/internal/constants/constants_windows.go index 3d14f52..59afbc2 100644 --- a/internal/constants/constants_windows.go +++ b/internal/constants/constants_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package constants diff --git a/internal/constants/defaults.go b/internal/constants/defaults.go index aba2dd8..b0e571d 100644 --- a/internal/constants/defaults.go +++ b/internal/constants/defaults.go @@ -6,11 +6,11 @@ const ConfigFileDefaultLocationUnexpanded = "$HOME/.dce/config.yaml" const DefaultConfigFileName string = "config.yaml" const GlobalTFTagDefaults string = `"Terraform":"True","AppName":"DCE","Source":"github.com/Optum/dce//modules"` const TerraformBinName = "terraform" -const TerraformBinVersion = "0.12.18" +const TerraformBinVersion = "1.5.7" const TerraformBinDownloadURLFormat = "https://releases.hashicorp.com/terraform/%s/terraform_%s_%s_%s.zip" // Default version of DCE to deploy, using `dce system deploy` -const DefaultDCEVersion = "0.29.0" +const DefaultDCEVersion = "0.38.0" // Default DCE Location const DefaultDCELocation = "github.com/Optum/dce" diff --git a/internal/observation/observation.go b/internal/observation/observation.go index f8232cf..6f43e8f 100644 --- a/internal/observation/observation.go +++ b/internal/observation/observation.go @@ -36,7 +36,7 @@ type Logger interface { Endln(args ...interface{}) } -//LevelLogger contains common functions for printing logs at different levels +// LevelLogger contains common functions for printing logs at different levels type LevelLogger interface { Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) diff --git a/internal/util/api.go b/internal/util/api.go index ea9e480..53d8325 100644 --- a/internal/util/api.go +++ b/internal/util/api.go @@ -2,7 +2,7 @@ package util import ( "bytes" - "io/ioutil" + "io" "time" apiclient "github.com/Optum/dce-cli/client" @@ -76,7 +76,7 @@ func (srt Sig4RoundTripper) RoundTrip(req *http.Request) (res *http.Response, e executeAPI := "execute-api" if req.Body != nil { - body, err := ioutil.ReadAll(req.Body) + body, err := io.ReadAll(req.Body) if err != nil { log.Fatalln("Error reading payload for v4 signing. ", err) } diff --git a/internal/util/filesystem.go b/internal/util/filesystem.go index 7a8b443..30dbf68 100644 --- a/internal/util/filesystem.go +++ b/internal/util/filesystem.go @@ -1,7 +1,6 @@ package util import ( - "io/ioutil" "os" "path/filepath" @@ -35,12 +34,12 @@ func (u *FileSystemUtil) writeToYAMLFile(path string, _struct interface{}) error if err != nil { return err } - // #nosec + //nolint:gosec defer file.Close() } - // #nosec - err = ioutil.WriteFile(path, _yaml, 0644) + //nolint:gosec + err = os.WriteFile(path, _yaml, 0644) if err != nil { return err } @@ -56,7 +55,7 @@ func (u *FileSystemUtil) WriteConfig() error { // ReadInConfig loads the configuration from the configuration file // and unmarshals it into the config object func (u *FileSystemUtil) ReadInConfig() error { - yamlStr, err := ioutil.ReadFile(u.ConfigFile) + yamlStr, err := os.ReadFile(u.ConfigFile) if err != nil { return err } @@ -98,7 +97,7 @@ func (u *FileSystemUtil) ReadFromFile(path string) string { /* #nosec CWE-22: added disclaimer to function docs */ - contents, err := ioutil.ReadFile(path) + contents, err := os.ReadFile(path) if err != nil { log.Fatalf("error: %v", err) } @@ -114,7 +113,7 @@ func (u *FileSystemUtil) ChToConfigDir() (string, string) { mode := int(0700) if _, err := os.Stat(destinationDir); os.IsNotExist(err) { - err := os.Mkdir(destinationDir, os.ModeDir|os.FileMode(mode)) + err := os.Mkdir(destinationDir, os.ModeDir|os.FileMode(mode)) //nolint:gosec if err != nil { log.Fatalln(err) } @@ -167,18 +166,22 @@ func (u *FileSystemUtil) Chdir(path string) { } func (u *FileSystemUtil) WriteFile(fileName string, data string) { - // #nosec - err := ioutil.WriteFile(fileName, []byte(data), 0644) + //nolint:gosec + err := os.WriteFile(fileName, []byte(data), 0644) if err != nil { log.Fatalln(err) } } func (u *FileSystemUtil) ReadDir(path string) []os.FileInfo { - files, err := ioutil.ReadDir(path) + entries, err := os.ReadDir(path) if err != nil { log.Fatalln(err) } + files := make([]os.FileInfo, len(entries)) + for i := range entries { + files[i], _ = entries[i].Info() + } return files } diff --git a/internal/util/github.go b/internal/util/github.go index f76f342..ad6c7a1 100644 --- a/internal/util/github.go +++ b/internal/util/github.go @@ -35,7 +35,7 @@ func (u *GithubUtil) DownloadGithubReleaseAsset(assetName string, releaseName st if err != nil { return err } - // #nosec + //nolint:gosec defer out.Close() _, err = io.Copy(out, resp.Body) if err != nil { diff --git a/internal/util/ifaces.go b/internal/util/ifaces.go index 34dc3d0..233ce60 100755 --- a/internal/util/ifaces.go +++ b/internal/util/ifaces.go @@ -9,20 +9,19 @@ import ( // APIer is an interface generated for "github.com/Optum/dce-cli/client/operations.Client". type APIer interface { - DeleteAccountsID(*operations.DeleteAccountsIDParams, runtime.ClientAuthInfoWriter) (*operations.DeleteAccountsIDNoContent, error) - DeleteLeases(*operations.DeleteLeasesParams, runtime.ClientAuthInfoWriter) (*operations.DeleteLeasesOK, error) - DeleteLeasesID(*operations.DeleteLeasesIDParams, runtime.ClientAuthInfoWriter) (*operations.DeleteLeasesIDOK, error) - GetAccounts(*operations.GetAccountsParams, runtime.ClientAuthInfoWriter) (*operations.GetAccountsOK, error) - GetAccountsID(*operations.GetAccountsIDParams, runtime.ClientAuthInfoWriter) (*operations.GetAccountsIDOK, error) - GetAuth(*operations.GetAuthParams) (*operations.GetAuthOK, error) - GetAuthFile(*operations.GetAuthFileParams) (*operations.GetAuthFileOK, error) - GetLeases(*operations.GetLeasesParams, runtime.ClientAuthInfoWriter) (*operations.GetLeasesOK, error) - GetLeasesID(*operations.GetLeasesIDParams, runtime.ClientAuthInfoWriter) (*operations.GetLeasesIDOK, error) - GetUsage(*operations.GetUsageParams, runtime.ClientAuthInfoWriter) (*operations.GetUsageOK, error) - PostAccounts(*operations.PostAccountsParams, runtime.ClientAuthInfoWriter) (*operations.PostAccountsCreated, error) - PostLeases(*operations.PostLeasesParams, runtime.ClientAuthInfoWriter) (*operations.PostLeasesCreated, error) - PostLeasesAuth(*operations.PostLeasesAuthParams, runtime.ClientAuthInfoWriter) (*operations.PostLeasesAuthCreated, error) - PostLeasesIDAuth(*operations.PostLeasesIDAuthParams, runtime.ClientAuthInfoWriter) (*operations.PostLeasesIDAuthCreated, error) - PutAccountsID(*operations.PutAccountsIDParams, runtime.ClientAuthInfoWriter) (*operations.PutAccountsIDOK, error) + DeleteAccountsID(*operations.DeleteAccountsIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.DeleteAccountsIDNoContent, error) + DeleteLeases(*operations.DeleteLeasesParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.DeleteLeasesOK, error) + DeleteLeasesID(*operations.DeleteLeasesIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.DeleteLeasesIDOK, error) + GetAccounts(*operations.GetAccountsParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.GetAccountsOK, error) + GetAccountsID(*operations.GetAccountsIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.GetAccountsIDOK, error) + GetAuth(*operations.GetAuthParams, ...operations.ClientOption) (*operations.GetAuthOK, error) + GetAuthFile(*operations.GetAuthFileParams, ...operations.ClientOption) (*operations.GetAuthFileOK, error) + GetLeases(*operations.GetLeasesParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.GetLeasesOK, error) + GetLeasesID(*operations.GetLeasesIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.GetLeasesIDOK, error) + GetUsage(*operations.GetUsageParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.GetUsageOK, error) + PostAccounts(*operations.PostAccountsParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.PostAccountsCreated, error) + PostLeases(*operations.PostLeasesParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.PostLeasesCreated, error) + PostLeasesIDAuth(*operations.PostLeasesIDAuthParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.PostLeasesIDAuthCreated, error) + PutAccountsID(*operations.PutAccountsIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.PutAccountsIDOK, error) SetTransport(runtime.ClientTransport) } diff --git a/internal/util/prompt.go b/internal/util/prompt.go index 473e67e..590ff15 100644 --- a/internal/util/prompt.go +++ b/internal/util/prompt.go @@ -17,10 +17,10 @@ func (u *PromptUtil) PromptBasic(label string, validator func(input string) erro Prompt: fmt.Sprint(label, " "), DisableAutoSaveHistory: true, }) - defer rl.Close() //nolint,errcheck if err != nil { log.Fatalln(err) } + defer rl.Close() //nolint:errcheck input, err := rl.Readline() if err != nil { diff --git a/internal/util/terraform.go b/internal/util/terraform.go index 50edf2d..1e501a8 100644 --- a/internal/util/terraform.go +++ b/internal/util/terraform.go @@ -173,7 +173,7 @@ func (t *TerraformBinUtil) Init(ctx context.Context, args []string) error { if err != nil { logFile = nil } else { - // #nosec + //nolint:gosec defer logFile.Close() } @@ -214,7 +214,7 @@ func (t *TerraformBinUtil) Apply(ctx context.Context, args []string) error { if err != nil { logFile = nil } else { - // #nosec + //nolint:gosec defer logFile.Close() } @@ -251,7 +251,7 @@ func (t *TerraformBinUtil) GetOutput(ctx context.Context, key string) (string, e if err != nil { logFile = nil } else { - // #nosec + //nolint:gosec defer logFile.Close() } @@ -260,8 +260,8 @@ func (t *TerraformBinUtil) GetOutput(ctx context.Context, key string) (string, e Name: t.bin(), Args: []string{ "output", + "-raw", key, - "-no-color", }, Dir: t.FileSystem.GetLocalTFModuleDir(), }, diff --git a/internal/util/util.go b/internal/util/util.go index 3b0b6f1..0905ada 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -155,7 +155,6 @@ type Durationer interface { } // TFTemplater is an interface for the templater that generates -// the main.tf file. type TFTemplater interface { // Add a terraform variable to the template AddVariable(name string, vartype string, vardefault string) error diff --git a/internal/util/web.go b/internal/util/web.go index 190ff21..add5c44 100644 --- a/internal/util/web.go +++ b/internal/util/web.go @@ -39,7 +39,7 @@ func (w *WebUtil) Download(url string, localpath string) error { if err != nil { return err } - // #nosec + //nolint:gosec defer out.Close() // Write the body to file diff --git a/mocks/APIer.go b/mocks/APIer.go index 0ba4c96..11ccf9a 100644 --- a/mocks/APIer.go +++ b/mocks/APIer.go @@ -1,32 +1,49 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks -import mock "github.com/stretchr/testify/mock" -import operations "github.com/Optum/dce-cli/client/operations" -import runtime "github.com/go-openapi/runtime" +import ( + operations "github.com/Optum/dce-cli/client/operations" + mock "github.com/stretchr/testify/mock" + + runtime "github.com/go-openapi/runtime" +) // APIer is an autogenerated mock type for the APIer type type APIer struct { mock.Mock } -// DeleteAccountsID provides a mock function with given fields: _a0, _a1 -func (_m *APIer) DeleteAccountsID(_a0 *operations.DeleteAccountsIDParams, _a1 runtime.ClientAuthInfoWriter) (*operations.DeleteAccountsIDNoContent, error) { - ret := _m.Called(_a0, _a1) +// DeleteAccountsID provides a mock function with given fields: _a0, _a1, _a2 +func (_m *APIer) DeleteAccountsID(_a0 *operations.DeleteAccountsIDParams, _a1 runtime.ClientAuthInfoWriter, _a2 ...operations.ClientOption) (*operations.DeleteAccountsIDNoContent, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for DeleteAccountsID") + } var r0 *operations.DeleteAccountsIDNoContent - if rf, ok := ret.Get(0).(func(*operations.DeleteAccountsIDParams, runtime.ClientAuthInfoWriter) *operations.DeleteAccountsIDNoContent); ok { - r0 = rf(_a0, _a1) + var r1 error + if rf, ok := ret.Get(0).(func(*operations.DeleteAccountsIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.DeleteAccountsIDNoContent, error)); ok { + return rf(_a0, _a1, _a2...) + } + if rf, ok := ret.Get(0).(func(*operations.DeleteAccountsIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.DeleteAccountsIDNoContent); ok { + r0 = rf(_a0, _a1, _a2...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*operations.DeleteAccountsIDNoContent) } } - var r1 error - if rf, ok := ret.Get(1).(func(*operations.DeleteAccountsIDParams, runtime.ClientAuthInfoWriter) error); ok { - r1 = rf(_a0, _a1) + if rf, ok := ret.Get(1).(func(*operations.DeleteAccountsIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(_a0, _a1, _a2...) } else { r1 = ret.Error(1) } @@ -34,22 +51,36 @@ func (_m *APIer) DeleteAccountsID(_a0 *operations.DeleteAccountsIDParams, _a1 ru return r0, r1 } -// DeleteLeases provides a mock function with given fields: _a0, _a1 -func (_m *APIer) DeleteLeases(_a0 *operations.DeleteLeasesParams, _a1 runtime.ClientAuthInfoWriter) (*operations.DeleteLeasesOK, error) { - ret := _m.Called(_a0, _a1) +// DeleteLeases provides a mock function with given fields: _a0, _a1, _a2 +func (_m *APIer) DeleteLeases(_a0 *operations.DeleteLeasesParams, _a1 runtime.ClientAuthInfoWriter, _a2 ...operations.ClientOption) (*operations.DeleteLeasesOK, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for DeleteLeases") + } var r0 *operations.DeleteLeasesOK - if rf, ok := ret.Get(0).(func(*operations.DeleteLeasesParams, runtime.ClientAuthInfoWriter) *operations.DeleteLeasesOK); ok { - r0 = rf(_a0, _a1) + var r1 error + if rf, ok := ret.Get(0).(func(*operations.DeleteLeasesParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.DeleteLeasesOK, error)); ok { + return rf(_a0, _a1, _a2...) + } + if rf, ok := ret.Get(0).(func(*operations.DeleteLeasesParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.DeleteLeasesOK); ok { + r0 = rf(_a0, _a1, _a2...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*operations.DeleteLeasesOK) } } - var r1 error - if rf, ok := ret.Get(1).(func(*operations.DeleteLeasesParams, runtime.ClientAuthInfoWriter) error); ok { - r1 = rf(_a0, _a1) + if rf, ok := ret.Get(1).(func(*operations.DeleteLeasesParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(_a0, _a1, _a2...) } else { r1 = ret.Error(1) } @@ -57,22 +88,36 @@ func (_m *APIer) DeleteLeases(_a0 *operations.DeleteLeasesParams, _a1 runtime.Cl return r0, r1 } -// DeleteLeasesID provides a mock function with given fields: _a0, _a1 -func (_m *APIer) DeleteLeasesID(_a0 *operations.DeleteLeasesIDParams, _a1 runtime.ClientAuthInfoWriter) (*operations.DeleteLeasesIDOK, error) { - ret := _m.Called(_a0, _a1) +// DeleteLeasesID provides a mock function with given fields: _a0, _a1, _a2 +func (_m *APIer) DeleteLeasesID(_a0 *operations.DeleteLeasesIDParams, _a1 runtime.ClientAuthInfoWriter, _a2 ...operations.ClientOption) (*operations.DeleteLeasesIDOK, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for DeleteLeasesID") + } var r0 *operations.DeleteLeasesIDOK - if rf, ok := ret.Get(0).(func(*operations.DeleteLeasesIDParams, runtime.ClientAuthInfoWriter) *operations.DeleteLeasesIDOK); ok { - r0 = rf(_a0, _a1) + var r1 error + if rf, ok := ret.Get(0).(func(*operations.DeleteLeasesIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.DeleteLeasesIDOK, error)); ok { + return rf(_a0, _a1, _a2...) + } + if rf, ok := ret.Get(0).(func(*operations.DeleteLeasesIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.DeleteLeasesIDOK); ok { + r0 = rf(_a0, _a1, _a2...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*operations.DeleteLeasesIDOK) } } - var r1 error - if rf, ok := ret.Get(1).(func(*operations.DeleteLeasesIDParams, runtime.ClientAuthInfoWriter) error); ok { - r1 = rf(_a0, _a1) + if rf, ok := ret.Get(1).(func(*operations.DeleteLeasesIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(_a0, _a1, _a2...) } else { r1 = ret.Error(1) } @@ -80,22 +125,36 @@ func (_m *APIer) DeleteLeasesID(_a0 *operations.DeleteLeasesIDParams, _a1 runtim return r0, r1 } -// GetAccounts provides a mock function with given fields: _a0, _a1 -func (_m *APIer) GetAccounts(_a0 *operations.GetAccountsParams, _a1 runtime.ClientAuthInfoWriter) (*operations.GetAccountsOK, error) { - ret := _m.Called(_a0, _a1) +// GetAccounts provides a mock function with given fields: _a0, _a1, _a2 +func (_m *APIer) GetAccounts(_a0 *operations.GetAccountsParams, _a1 runtime.ClientAuthInfoWriter, _a2 ...operations.ClientOption) (*operations.GetAccountsOK, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for GetAccounts") + } var r0 *operations.GetAccountsOK - if rf, ok := ret.Get(0).(func(*operations.GetAccountsParams, runtime.ClientAuthInfoWriter) *operations.GetAccountsOK); ok { - r0 = rf(_a0, _a1) + var r1 error + if rf, ok := ret.Get(0).(func(*operations.GetAccountsParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.GetAccountsOK, error)); ok { + return rf(_a0, _a1, _a2...) + } + if rf, ok := ret.Get(0).(func(*operations.GetAccountsParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.GetAccountsOK); ok { + r0 = rf(_a0, _a1, _a2...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*operations.GetAccountsOK) } } - var r1 error - if rf, ok := ret.Get(1).(func(*operations.GetAccountsParams, runtime.ClientAuthInfoWriter) error); ok { - r1 = rf(_a0, _a1) + if rf, ok := ret.Get(1).(func(*operations.GetAccountsParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(_a0, _a1, _a2...) } else { r1 = ret.Error(1) } @@ -103,22 +162,36 @@ func (_m *APIer) GetAccounts(_a0 *operations.GetAccountsParams, _a1 runtime.Clie return r0, r1 } -// GetAccountsID provides a mock function with given fields: _a0, _a1 -func (_m *APIer) GetAccountsID(_a0 *operations.GetAccountsIDParams, _a1 runtime.ClientAuthInfoWriter) (*operations.GetAccountsIDOK, error) { - ret := _m.Called(_a0, _a1) +// GetAccountsID provides a mock function with given fields: _a0, _a1, _a2 +func (_m *APIer) GetAccountsID(_a0 *operations.GetAccountsIDParams, _a1 runtime.ClientAuthInfoWriter, _a2 ...operations.ClientOption) (*operations.GetAccountsIDOK, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for GetAccountsID") + } var r0 *operations.GetAccountsIDOK - if rf, ok := ret.Get(0).(func(*operations.GetAccountsIDParams, runtime.ClientAuthInfoWriter) *operations.GetAccountsIDOK); ok { - r0 = rf(_a0, _a1) + var r1 error + if rf, ok := ret.Get(0).(func(*operations.GetAccountsIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.GetAccountsIDOK, error)); ok { + return rf(_a0, _a1, _a2...) + } + if rf, ok := ret.Get(0).(func(*operations.GetAccountsIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.GetAccountsIDOK); ok { + r0 = rf(_a0, _a1, _a2...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*operations.GetAccountsIDOK) } } - var r1 error - if rf, ok := ret.Get(1).(func(*operations.GetAccountsIDParams, runtime.ClientAuthInfoWriter) error); ok { - r1 = rf(_a0, _a1) + if rf, ok := ret.Get(1).(func(*operations.GetAccountsIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(_a0, _a1, _a2...) } else { r1 = ret.Error(1) } @@ -126,22 +199,36 @@ func (_m *APIer) GetAccountsID(_a0 *operations.GetAccountsIDParams, _a1 runtime. return r0, r1 } -// GetAuth provides a mock function with given fields: _a0 -func (_m *APIer) GetAuth(_a0 *operations.GetAuthParams) (*operations.GetAuthOK, error) { - ret := _m.Called(_a0) +// GetAuth provides a mock function with given fields: _a0, _a1 +func (_m *APIer) GetAuth(_a0 *operations.GetAuthParams, _a1 ...operations.ClientOption) (*operations.GetAuthOK, error) { + _va := make([]interface{}, len(_a1)) + for _i := range _a1 { + _va[_i] = _a1[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for GetAuth") + } var r0 *operations.GetAuthOK - if rf, ok := ret.Get(0).(func(*operations.GetAuthParams) *operations.GetAuthOK); ok { - r0 = rf(_a0) + var r1 error + if rf, ok := ret.Get(0).(func(*operations.GetAuthParams, ...operations.ClientOption) (*operations.GetAuthOK, error)); ok { + return rf(_a0, _a1...) + } + if rf, ok := ret.Get(0).(func(*operations.GetAuthParams, ...operations.ClientOption) *operations.GetAuthOK); ok { + r0 = rf(_a0, _a1...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*operations.GetAuthOK) } } - var r1 error - if rf, ok := ret.Get(1).(func(*operations.GetAuthParams) error); ok { - r1 = rf(_a0) + if rf, ok := ret.Get(1).(func(*operations.GetAuthParams, ...operations.ClientOption) error); ok { + r1 = rf(_a0, _a1...) } else { r1 = ret.Error(1) } @@ -149,22 +236,36 @@ func (_m *APIer) GetAuth(_a0 *operations.GetAuthParams) (*operations.GetAuthOK, return r0, r1 } -// GetAuthFile provides a mock function with given fields: _a0 -func (_m *APIer) GetAuthFile(_a0 *operations.GetAuthFileParams) (*operations.GetAuthFileOK, error) { - ret := _m.Called(_a0) +// GetAuthFile provides a mock function with given fields: _a0, _a1 +func (_m *APIer) GetAuthFile(_a0 *operations.GetAuthFileParams, _a1 ...operations.ClientOption) (*operations.GetAuthFileOK, error) { + _va := make([]interface{}, len(_a1)) + for _i := range _a1 { + _va[_i] = _a1[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for GetAuthFile") + } var r0 *operations.GetAuthFileOK - if rf, ok := ret.Get(0).(func(*operations.GetAuthFileParams) *operations.GetAuthFileOK); ok { - r0 = rf(_a0) + var r1 error + if rf, ok := ret.Get(0).(func(*operations.GetAuthFileParams, ...operations.ClientOption) (*operations.GetAuthFileOK, error)); ok { + return rf(_a0, _a1...) + } + if rf, ok := ret.Get(0).(func(*operations.GetAuthFileParams, ...operations.ClientOption) *operations.GetAuthFileOK); ok { + r0 = rf(_a0, _a1...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*operations.GetAuthFileOK) } } - var r1 error - if rf, ok := ret.Get(1).(func(*operations.GetAuthFileParams) error); ok { - r1 = rf(_a0) + if rf, ok := ret.Get(1).(func(*operations.GetAuthFileParams, ...operations.ClientOption) error); ok { + r1 = rf(_a0, _a1...) } else { r1 = ret.Error(1) } @@ -172,22 +273,36 @@ func (_m *APIer) GetAuthFile(_a0 *operations.GetAuthFileParams) (*operations.Get return r0, r1 } -// GetLeases provides a mock function with given fields: _a0, _a1 -func (_m *APIer) GetLeases(_a0 *operations.GetLeasesParams, _a1 runtime.ClientAuthInfoWriter) (*operations.GetLeasesOK, error) { - ret := _m.Called(_a0, _a1) +// GetLeases provides a mock function with given fields: _a0, _a1, _a2 +func (_m *APIer) GetLeases(_a0 *operations.GetLeasesParams, _a1 runtime.ClientAuthInfoWriter, _a2 ...operations.ClientOption) (*operations.GetLeasesOK, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for GetLeases") + } var r0 *operations.GetLeasesOK - if rf, ok := ret.Get(0).(func(*operations.GetLeasesParams, runtime.ClientAuthInfoWriter) *operations.GetLeasesOK); ok { - r0 = rf(_a0, _a1) + var r1 error + if rf, ok := ret.Get(0).(func(*operations.GetLeasesParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.GetLeasesOK, error)); ok { + return rf(_a0, _a1, _a2...) + } + if rf, ok := ret.Get(0).(func(*operations.GetLeasesParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.GetLeasesOK); ok { + r0 = rf(_a0, _a1, _a2...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*operations.GetLeasesOK) } } - var r1 error - if rf, ok := ret.Get(1).(func(*operations.GetLeasesParams, runtime.ClientAuthInfoWriter) error); ok { - r1 = rf(_a0, _a1) + if rf, ok := ret.Get(1).(func(*operations.GetLeasesParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(_a0, _a1, _a2...) } else { r1 = ret.Error(1) } @@ -195,22 +310,36 @@ func (_m *APIer) GetLeases(_a0 *operations.GetLeasesParams, _a1 runtime.ClientAu return r0, r1 } -// GetLeasesID provides a mock function with given fields: _a0, _a1 -func (_m *APIer) GetLeasesID(_a0 *operations.GetLeasesIDParams, _a1 runtime.ClientAuthInfoWriter) (*operations.GetLeasesIDOK, error) { - ret := _m.Called(_a0, _a1) +// GetLeasesID provides a mock function with given fields: _a0, _a1, _a2 +func (_m *APIer) GetLeasesID(_a0 *operations.GetLeasesIDParams, _a1 runtime.ClientAuthInfoWriter, _a2 ...operations.ClientOption) (*operations.GetLeasesIDOK, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for GetLeasesID") + } var r0 *operations.GetLeasesIDOK - if rf, ok := ret.Get(0).(func(*operations.GetLeasesIDParams, runtime.ClientAuthInfoWriter) *operations.GetLeasesIDOK); ok { - r0 = rf(_a0, _a1) + var r1 error + if rf, ok := ret.Get(0).(func(*operations.GetLeasesIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.GetLeasesIDOK, error)); ok { + return rf(_a0, _a1, _a2...) + } + if rf, ok := ret.Get(0).(func(*operations.GetLeasesIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.GetLeasesIDOK); ok { + r0 = rf(_a0, _a1, _a2...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*operations.GetLeasesIDOK) } } - var r1 error - if rf, ok := ret.Get(1).(func(*operations.GetLeasesIDParams, runtime.ClientAuthInfoWriter) error); ok { - r1 = rf(_a0, _a1) + if rf, ok := ret.Get(1).(func(*operations.GetLeasesIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(_a0, _a1, _a2...) } else { r1 = ret.Error(1) } @@ -218,22 +347,36 @@ func (_m *APIer) GetLeasesID(_a0 *operations.GetLeasesIDParams, _a1 runtime.Clie return r0, r1 } -// GetUsage provides a mock function with given fields: _a0, _a1 -func (_m *APIer) GetUsage(_a0 *operations.GetUsageParams, _a1 runtime.ClientAuthInfoWriter) (*operations.GetUsageOK, error) { - ret := _m.Called(_a0, _a1) +// GetUsage provides a mock function with given fields: _a0, _a1, _a2 +func (_m *APIer) GetUsage(_a0 *operations.GetUsageParams, _a1 runtime.ClientAuthInfoWriter, _a2 ...operations.ClientOption) (*operations.GetUsageOK, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for GetUsage") + } var r0 *operations.GetUsageOK - if rf, ok := ret.Get(0).(func(*operations.GetUsageParams, runtime.ClientAuthInfoWriter) *operations.GetUsageOK); ok { - r0 = rf(_a0, _a1) + var r1 error + if rf, ok := ret.Get(0).(func(*operations.GetUsageParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.GetUsageOK, error)); ok { + return rf(_a0, _a1, _a2...) + } + if rf, ok := ret.Get(0).(func(*operations.GetUsageParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.GetUsageOK); ok { + r0 = rf(_a0, _a1, _a2...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*operations.GetUsageOK) } } - var r1 error - if rf, ok := ret.Get(1).(func(*operations.GetUsageParams, runtime.ClientAuthInfoWriter) error); ok { - r1 = rf(_a0, _a1) + if rf, ok := ret.Get(1).(func(*operations.GetUsageParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(_a0, _a1, _a2...) } else { r1 = ret.Error(1) } @@ -241,22 +384,36 @@ func (_m *APIer) GetUsage(_a0 *operations.GetUsageParams, _a1 runtime.ClientAuth return r0, r1 } -// PostAccounts provides a mock function with given fields: _a0, _a1 -func (_m *APIer) PostAccounts(_a0 *operations.PostAccountsParams, _a1 runtime.ClientAuthInfoWriter) (*operations.PostAccountsCreated, error) { - ret := _m.Called(_a0, _a1) +// PostAccounts provides a mock function with given fields: _a0, _a1, _a2 +func (_m *APIer) PostAccounts(_a0 *operations.PostAccountsParams, _a1 runtime.ClientAuthInfoWriter, _a2 ...operations.ClientOption) (*operations.PostAccountsCreated, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for PostAccounts") + } var r0 *operations.PostAccountsCreated - if rf, ok := ret.Get(0).(func(*operations.PostAccountsParams, runtime.ClientAuthInfoWriter) *operations.PostAccountsCreated); ok { - r0 = rf(_a0, _a1) + var r1 error + if rf, ok := ret.Get(0).(func(*operations.PostAccountsParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.PostAccountsCreated, error)); ok { + return rf(_a0, _a1, _a2...) + } + if rf, ok := ret.Get(0).(func(*operations.PostAccountsParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.PostAccountsCreated); ok { + r0 = rf(_a0, _a1, _a2...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*operations.PostAccountsCreated) } } - var r1 error - if rf, ok := ret.Get(1).(func(*operations.PostAccountsParams, runtime.ClientAuthInfoWriter) error); ok { - r1 = rf(_a0, _a1) + if rf, ok := ret.Get(1).(func(*operations.PostAccountsParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(_a0, _a1, _a2...) } else { r1 = ret.Error(1) } @@ -264,22 +421,36 @@ func (_m *APIer) PostAccounts(_a0 *operations.PostAccountsParams, _a1 runtime.Cl return r0, r1 } -// PostLeases provides a mock function with given fields: _a0, _a1 -func (_m *APIer) PostLeases(_a0 *operations.PostLeasesParams, _a1 runtime.ClientAuthInfoWriter) (*operations.PostLeasesCreated, error) { - ret := _m.Called(_a0, _a1) +// PostLeases provides a mock function with given fields: _a0, _a1, _a2 +func (_m *APIer) PostLeases(_a0 *operations.PostLeasesParams, _a1 runtime.ClientAuthInfoWriter, _a2 ...operations.ClientOption) (*operations.PostLeasesCreated, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for PostLeases") + } var r0 *operations.PostLeasesCreated - if rf, ok := ret.Get(0).(func(*operations.PostLeasesParams, runtime.ClientAuthInfoWriter) *operations.PostLeasesCreated); ok { - r0 = rf(_a0, _a1) + var r1 error + if rf, ok := ret.Get(0).(func(*operations.PostLeasesParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.PostLeasesCreated, error)); ok { + return rf(_a0, _a1, _a2...) + } + if rf, ok := ret.Get(0).(func(*operations.PostLeasesParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.PostLeasesCreated); ok { + r0 = rf(_a0, _a1, _a2...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*operations.PostLeasesCreated) } } - var r1 error - if rf, ok := ret.Get(1).(func(*operations.PostLeasesParams, runtime.ClientAuthInfoWriter) error); ok { - r1 = rf(_a0, _a1) + if rf, ok := ret.Get(1).(func(*operations.PostLeasesParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(_a0, _a1, _a2...) } else { r1 = ret.Error(1) } @@ -287,45 +458,36 @@ func (_m *APIer) PostLeases(_a0 *operations.PostLeasesParams, _a1 runtime.Client return r0, r1 } -// PostLeasesAuth provides a mock function with given fields: _a0, _a1 -func (_m *APIer) PostLeasesAuth(_a0 *operations.PostLeasesAuthParams, _a1 runtime.ClientAuthInfoWriter) (*operations.PostLeasesAuthCreated, error) { - ret := _m.Called(_a0, _a1) - - var r0 *operations.PostLeasesAuthCreated - if rf, ok := ret.Get(0).(func(*operations.PostLeasesAuthParams, runtime.ClientAuthInfoWriter) *operations.PostLeasesAuthCreated); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*operations.PostLeasesAuthCreated) - } +// PostLeasesIDAuth provides a mock function with given fields: _a0, _a1, _a2 +func (_m *APIer) PostLeasesIDAuth(_a0 *operations.PostLeasesIDAuthParams, _a1 runtime.ClientAuthInfoWriter, _a2 ...operations.ClientOption) (*operations.PostLeasesIDAuthCreated, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) - var r1 error - if rf, ok := ret.Get(1).(func(*operations.PostLeasesAuthParams, runtime.ClientAuthInfoWriter) error); ok { - r1 = rf(_a0, _a1) - } else { - r1 = ret.Error(1) + if len(ret) == 0 { + panic("no return value specified for PostLeasesIDAuth") } - return r0, r1 -} - -// PostLeasesIDAuth provides a mock function with given fields: _a0, _a1 -func (_m *APIer) PostLeasesIDAuth(_a0 *operations.PostLeasesIDAuthParams, _a1 runtime.ClientAuthInfoWriter) (*operations.PostLeasesIDAuthCreated, error) { - ret := _m.Called(_a0, _a1) - var r0 *operations.PostLeasesIDAuthCreated - if rf, ok := ret.Get(0).(func(*operations.PostLeasesIDAuthParams, runtime.ClientAuthInfoWriter) *operations.PostLeasesIDAuthCreated); ok { - r0 = rf(_a0, _a1) + var r1 error + if rf, ok := ret.Get(0).(func(*operations.PostLeasesIDAuthParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.PostLeasesIDAuthCreated, error)); ok { + return rf(_a0, _a1, _a2...) + } + if rf, ok := ret.Get(0).(func(*operations.PostLeasesIDAuthParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.PostLeasesIDAuthCreated); ok { + r0 = rf(_a0, _a1, _a2...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*operations.PostLeasesIDAuthCreated) } } - var r1 error - if rf, ok := ret.Get(1).(func(*operations.PostLeasesIDAuthParams, runtime.ClientAuthInfoWriter) error); ok { - r1 = rf(_a0, _a1) + if rf, ok := ret.Get(1).(func(*operations.PostLeasesIDAuthParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(_a0, _a1, _a2...) } else { r1 = ret.Error(1) } @@ -333,22 +495,36 @@ func (_m *APIer) PostLeasesIDAuth(_a0 *operations.PostLeasesIDAuthParams, _a1 ru return r0, r1 } -// PutAccountsID provides a mock function with given fields: _a0, _a1 -func (_m *APIer) PutAccountsID(_a0 *operations.PutAccountsIDParams, _a1 runtime.ClientAuthInfoWriter) (*operations.PutAccountsIDOK, error) { - ret := _m.Called(_a0, _a1) +// PutAccountsID provides a mock function with given fields: _a0, _a1, _a2 +func (_m *APIer) PutAccountsID(_a0 *operations.PutAccountsIDParams, _a1 runtime.ClientAuthInfoWriter, _a2 ...operations.ClientOption) (*operations.PutAccountsIDOK, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for PutAccountsID") + } var r0 *operations.PutAccountsIDOK - if rf, ok := ret.Get(0).(func(*operations.PutAccountsIDParams, runtime.ClientAuthInfoWriter) *operations.PutAccountsIDOK); ok { - r0 = rf(_a0, _a1) + var r1 error + if rf, ok := ret.Get(0).(func(*operations.PutAccountsIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.PutAccountsIDOK, error)); ok { + return rf(_a0, _a1, _a2...) + } + if rf, ok := ret.Get(0).(func(*operations.PutAccountsIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.PutAccountsIDOK); ok { + r0 = rf(_a0, _a1, _a2...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*operations.PutAccountsIDOK) } } - var r1 error - if rf, ok := ret.Get(1).(func(*operations.PutAccountsIDParams, runtime.ClientAuthInfoWriter) error); ok { - r1 = rf(_a0, _a1) + if rf, ok := ret.Get(1).(func(*operations.PutAccountsIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(_a0, _a1, _a2...) } else { r1 = ret.Error(1) } @@ -360,3 +536,17 @@ func (_m *APIer) PutAccountsID(_a0 *operations.PutAccountsIDParams, _a1 runtime. func (_m *APIer) SetTransport(_a0 runtime.ClientTransport) { _m.Called(_a0) } + +// NewAPIer creates a new instance of APIer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewAPIer(t interface { + mock.TestingT + Cleanup(func()) +}) *APIer { + mock := &APIer{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/AWSer.go b/mocks/AWSer.go index a898a7d..c90d771 100644 --- a/mocks/AWSer.go +++ b/mocks/AWSer.go @@ -1,4 +1,4 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks @@ -23,7 +23,15 @@ func (_m *AWSer) UpdateLambdasFromS3Assets(lambdaNames []string, bucket string, func (_m *AWSer) UploadDirectoryToS3(localPath string, bucket string, prefix string) ([]string, []string) { ret := _m.Called(localPath, bucket, prefix) + if len(ret) == 0 { + panic("no return value specified for UploadDirectoryToS3") + } + var r0 []string + var r1 []string + if rf, ok := ret.Get(0).(func(string, string, string) ([]string, []string)); ok { + return rf(localPath, bucket, prefix) + } if rf, ok := ret.Get(0).(func(string, string, string) []string); ok { r0 = rf(localPath, bucket, prefix) } else { @@ -32,7 +40,6 @@ func (_m *AWSer) UploadDirectoryToS3(localPath string, bucket string, prefix str } } - var r1 []string if rf, ok := ret.Get(1).(func(string, string, string) []string); ok { r1 = rf(localPath, bucket, prefix) } else { @@ -43,3 +50,17 @@ func (_m *AWSer) UploadDirectoryToS3(localPath string, bucket string, prefix str return r0, r1 } + +// NewAWSer creates a new instance of AWSer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewAWSer(t interface { + mock.TestingT + Cleanup(func()) +}) *AWSer { + mock := &AWSer{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/Accounter.go b/mocks/Accounter.go index 94cb8ca..e4e724d 100644 --- a/mocks/Accounter.go +++ b/mocks/Accounter.go @@ -1,4 +1,4 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks @@ -28,3 +28,17 @@ func (_m *Accounter) ListAccounts() { func (_m *Accounter) RemoveAccount(accountID string) { _m.Called(accountID) } + +// NewAccounter creates a new instance of Accounter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewAccounter(t interface { + mock.TestingT + Cleanup(func()) +}) *Accounter { + mock := &Accounter{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/Authenticater.go b/mocks/Authenticater.go index 66155dd..62d767d 100644 --- a/mocks/Authenticater.go +++ b/mocks/Authenticater.go @@ -1,4 +1,4 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks @@ -13,6 +13,10 @@ type Authenticater struct { func (_m *Authenticater) Authenticate() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Authenticate") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -22,3 +26,17 @@ func (_m *Authenticater) Authenticate() error { return r0 } + +// NewAuthenticater creates a new instance of Authenticater. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewAuthenticater(t interface { + mock.TestingT + Cleanup(func()) +}) *Authenticater { + mock := &Authenticater{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/ClientOption.go b/mocks/ClientOption.go new file mode 100644 index 0000000..c16220d --- /dev/null +++ b/mocks/ClientOption.go @@ -0,0 +1,33 @@ +// Code generated by mockery v2.45.0. DO NOT EDIT. + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" + + runtime "github.com/go-openapi/runtime" +) + +// ClientOption is an autogenerated mock type for the ClientOption type +type ClientOption struct { + mock.Mock +} + +// Execute provides a mock function with given fields: _a0 +func (_m *ClientOption) Execute(_a0 *runtime.ClientOperation) { + _m.Called(_a0) +} + +// NewClientOption creates a new instance of ClientOption. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewClientOption(t interface { + mock.TestingT + Cleanup(func()) +}) *ClientOption { + mock := &ClientOption{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/ClientService.go b/mocks/ClientService.go index e56f84b..3f88bd9 100644 --- a/mocks/ClientService.go +++ b/mocks/ClientService.go @@ -1,32 +1,49 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks -import c_o_r_s "github.com/Optum/dce-cli/client/c_o_r_s" -import mock "github.com/stretchr/testify/mock" -import runtime "github.com/go-openapi/runtime" +import ( + operations "github.com/Optum/dce-cli/client/operations" + mock "github.com/stretchr/testify/mock" + + runtime "github.com/go-openapi/runtime" +) // ClientService is an autogenerated mock type for the ClientService type type ClientService struct { mock.Mock } -// OptionsAccounts provides a mock function with given fields: params -func (_m *ClientService) OptionsAccounts(params *c_o_r_s.OptionsAccountsParams) (*c_o_r_s.OptionsAccountsOK, error) { - ret := _m.Called(params) +// DeleteAccountsID provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) DeleteAccountsID(params *operations.DeleteAccountsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...operations.ClientOption) (*operations.DeleteAccountsIDNoContent, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) - var r0 *c_o_r_s.OptionsAccountsOK - if rf, ok := ret.Get(0).(func(*c_o_r_s.OptionsAccountsParams) *c_o_r_s.OptionsAccountsOK); ok { - r0 = rf(params) + if len(ret) == 0 { + panic("no return value specified for DeleteAccountsID") + } + + var r0 *operations.DeleteAccountsIDNoContent + var r1 error + if rf, ok := ret.Get(0).(func(*operations.DeleteAccountsIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.DeleteAccountsIDNoContent, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*operations.DeleteAccountsIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.DeleteAccountsIDNoContent); ok { + r0 = rf(params, authInfo, opts...) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*c_o_r_s.OptionsAccountsOK) + r0 = ret.Get(0).(*operations.DeleteAccountsIDNoContent) } } - var r1 error - if rf, ok := ret.Get(1).(func(*c_o_r_s.OptionsAccountsParams) error); ok { - r1 = rf(params) + if rf, ok := ret.Get(1).(func(*operations.DeleteAccountsIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) } else { r1 = ret.Error(1) } @@ -34,22 +51,36 @@ func (_m *ClientService) OptionsAccounts(params *c_o_r_s.OptionsAccountsParams) return r0, r1 } -// OptionsAccountsID provides a mock function with given fields: params -func (_m *ClientService) OptionsAccountsID(params *c_o_r_s.OptionsAccountsIDParams) (*c_o_r_s.OptionsAccountsIDOK, error) { - ret := _m.Called(params) +// DeleteLeases provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) DeleteLeases(params *operations.DeleteLeasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...operations.ClientOption) (*operations.DeleteLeasesOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for DeleteLeases") + } - var r0 *c_o_r_s.OptionsAccountsIDOK - if rf, ok := ret.Get(0).(func(*c_o_r_s.OptionsAccountsIDParams) *c_o_r_s.OptionsAccountsIDOK); ok { - r0 = rf(params) + var r0 *operations.DeleteLeasesOK + var r1 error + if rf, ok := ret.Get(0).(func(*operations.DeleteLeasesParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.DeleteLeasesOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*operations.DeleteLeasesParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.DeleteLeasesOK); ok { + r0 = rf(params, authInfo, opts...) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*c_o_r_s.OptionsAccountsIDOK) + r0 = ret.Get(0).(*operations.DeleteLeasesOK) } } - var r1 error - if rf, ok := ret.Get(1).(func(*c_o_r_s.OptionsAccountsIDParams) error); ok { - r1 = rf(params) + if rf, ok := ret.Get(1).(func(*operations.DeleteLeasesParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) } else { r1 = ret.Error(1) } @@ -57,22 +88,36 @@ func (_m *ClientService) OptionsAccountsID(params *c_o_r_s.OptionsAccountsIDPara return r0, r1 } -// OptionsAuth provides a mock function with given fields: params -func (_m *ClientService) OptionsAuth(params *c_o_r_s.OptionsAuthParams) (*c_o_r_s.OptionsAuthOK, error) { - ret := _m.Called(params) +// DeleteLeasesID provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) DeleteLeasesID(params *operations.DeleteLeasesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...operations.ClientOption) (*operations.DeleteLeasesIDOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) - var r0 *c_o_r_s.OptionsAuthOK - if rf, ok := ret.Get(0).(func(*c_o_r_s.OptionsAuthParams) *c_o_r_s.OptionsAuthOK); ok { - r0 = rf(params) + if len(ret) == 0 { + panic("no return value specified for DeleteLeasesID") + } + + var r0 *operations.DeleteLeasesIDOK + var r1 error + if rf, ok := ret.Get(0).(func(*operations.DeleteLeasesIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.DeleteLeasesIDOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*operations.DeleteLeasesIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.DeleteLeasesIDOK); ok { + r0 = rf(params, authInfo, opts...) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*c_o_r_s.OptionsAuthOK) + r0 = ret.Get(0).(*operations.DeleteLeasesIDOK) } } - var r1 error - if rf, ok := ret.Get(1).(func(*c_o_r_s.OptionsAuthParams) error); ok { - r1 = rf(params) + if rf, ok := ret.Get(1).(func(*operations.DeleteLeasesIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) } else { r1 = ret.Error(1) } @@ -80,22 +125,36 @@ func (_m *ClientService) OptionsAuth(params *c_o_r_s.OptionsAuthParams) (*c_o_r_ return r0, r1 } -// OptionsAuthFile provides a mock function with given fields: params -func (_m *ClientService) OptionsAuthFile(params *c_o_r_s.OptionsAuthFileParams) (*c_o_r_s.OptionsAuthFileOK, error) { - ret := _m.Called(params) +// GetAccounts provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) GetAccounts(params *operations.GetAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...operations.ClientOption) (*operations.GetAccountsOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) - var r0 *c_o_r_s.OptionsAuthFileOK - if rf, ok := ret.Get(0).(func(*c_o_r_s.OptionsAuthFileParams) *c_o_r_s.OptionsAuthFileOK); ok { - r0 = rf(params) + if len(ret) == 0 { + panic("no return value specified for GetAccounts") + } + + var r0 *operations.GetAccountsOK + var r1 error + if rf, ok := ret.Get(0).(func(*operations.GetAccountsParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.GetAccountsOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*operations.GetAccountsParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.GetAccountsOK); ok { + r0 = rf(params, authInfo, opts...) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*c_o_r_s.OptionsAuthFileOK) + r0 = ret.Get(0).(*operations.GetAccountsOK) } } - var r1 error - if rf, ok := ret.Get(1).(func(*c_o_r_s.OptionsAuthFileParams) error); ok { - r1 = rf(params) + if rf, ok := ret.Get(1).(func(*operations.GetAccountsParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) } else { r1 = ret.Error(1) } @@ -103,22 +162,73 @@ func (_m *ClientService) OptionsAuthFile(params *c_o_r_s.OptionsAuthFileParams) return r0, r1 } -// OptionsLeases provides a mock function with given fields: params -func (_m *ClientService) OptionsLeases(params *c_o_r_s.OptionsLeasesParams) (*c_o_r_s.OptionsLeasesOK, error) { - ret := _m.Called(params) +// GetAccountsID provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) GetAccountsID(params *operations.GetAccountsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...operations.ClientOption) (*operations.GetAccountsIDOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) - var r0 *c_o_r_s.OptionsLeasesOK - if rf, ok := ret.Get(0).(func(*c_o_r_s.OptionsLeasesParams) *c_o_r_s.OptionsLeasesOK); ok { - r0 = rf(params) + if len(ret) == 0 { + panic("no return value specified for GetAccountsID") + } + + var r0 *operations.GetAccountsIDOK + var r1 error + if rf, ok := ret.Get(0).(func(*operations.GetAccountsIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.GetAccountsIDOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*operations.GetAccountsIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.GetAccountsIDOK); ok { + r0 = rf(params, authInfo, opts...) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*c_o_r_s.OptionsLeasesOK) + r0 = ret.Get(0).(*operations.GetAccountsIDOK) } } + if rf, ok := ret.Get(1).(func(*operations.GetAccountsIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetAuth provides a mock function with given fields: params, opts +func (_m *ClientService) GetAuth(params *operations.GetAuthParams, opts ...operations.ClientOption) (*operations.GetAuthOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for GetAuth") + } + + var r0 *operations.GetAuthOK var r1 error - if rf, ok := ret.Get(1).(func(*c_o_r_s.OptionsLeasesParams) error); ok { - r1 = rf(params) + if rf, ok := ret.Get(0).(func(*operations.GetAuthParams, ...operations.ClientOption) (*operations.GetAuthOK, error)); ok { + return rf(params, opts...) + } + if rf, ok := ret.Get(0).(func(*operations.GetAuthParams, ...operations.ClientOption) *operations.GetAuthOK); ok { + r0 = rf(params, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*operations.GetAuthOK) + } + } + + if rf, ok := ret.Get(1).(func(*operations.GetAuthParams, ...operations.ClientOption) error); ok { + r1 = rf(params, opts...) } else { r1 = ret.Error(1) } @@ -126,22 +236,73 @@ func (_m *ClientService) OptionsLeases(params *c_o_r_s.OptionsLeasesParams) (*c_ return r0, r1 } -// OptionsLeasesAuth provides a mock function with given fields: params -func (_m *ClientService) OptionsLeasesAuth(params *c_o_r_s.OptionsLeasesAuthParams) (*c_o_r_s.OptionsLeasesAuthOK, error) { - ret := _m.Called(params) +// GetAuthFile provides a mock function with given fields: params, opts +func (_m *ClientService) GetAuthFile(params *operations.GetAuthFileParams, opts ...operations.ClientOption) (*operations.GetAuthFileOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) - var r0 *c_o_r_s.OptionsLeasesAuthOK - if rf, ok := ret.Get(0).(func(*c_o_r_s.OptionsLeasesAuthParams) *c_o_r_s.OptionsLeasesAuthOK); ok { - r0 = rf(params) + if len(ret) == 0 { + panic("no return value specified for GetAuthFile") + } + + var r0 *operations.GetAuthFileOK + var r1 error + if rf, ok := ret.Get(0).(func(*operations.GetAuthFileParams, ...operations.ClientOption) (*operations.GetAuthFileOK, error)); ok { + return rf(params, opts...) + } + if rf, ok := ret.Get(0).(func(*operations.GetAuthFileParams, ...operations.ClientOption) *operations.GetAuthFileOK); ok { + r0 = rf(params, opts...) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*c_o_r_s.OptionsLeasesAuthOK) + r0 = ret.Get(0).(*operations.GetAuthFileOK) } } + if rf, ok := ret.Get(1).(func(*operations.GetAuthFileParams, ...operations.ClientOption) error); ok { + r1 = rf(params, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetLeases provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) GetLeases(params *operations.GetLeasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...operations.ClientOption) (*operations.GetLeasesOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for GetLeases") + } + + var r0 *operations.GetLeasesOK var r1 error - if rf, ok := ret.Get(1).(func(*c_o_r_s.OptionsLeasesAuthParams) error); ok { - r1 = rf(params) + if rf, ok := ret.Get(0).(func(*operations.GetLeasesParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.GetLeasesOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*operations.GetLeasesParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.GetLeasesOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*operations.GetLeasesOK) + } + } + + if rf, ok := ret.Get(1).(func(*operations.GetLeasesParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) } else { r1 = ret.Error(1) } @@ -149,22 +310,73 @@ func (_m *ClientService) OptionsLeasesAuth(params *c_o_r_s.OptionsLeasesAuthPara return r0, r1 } -// OptionsLeasesID provides a mock function with given fields: params -func (_m *ClientService) OptionsLeasesID(params *c_o_r_s.OptionsLeasesIDParams) (*c_o_r_s.OptionsLeasesIDOK, error) { - ret := _m.Called(params) +// GetLeasesID provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) GetLeasesID(params *operations.GetLeasesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...operations.ClientOption) (*operations.GetLeasesIDOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) - var r0 *c_o_r_s.OptionsLeasesIDOK - if rf, ok := ret.Get(0).(func(*c_o_r_s.OptionsLeasesIDParams) *c_o_r_s.OptionsLeasesIDOK); ok { - r0 = rf(params) + if len(ret) == 0 { + panic("no return value specified for GetLeasesID") + } + + var r0 *operations.GetLeasesIDOK + var r1 error + if rf, ok := ret.Get(0).(func(*operations.GetLeasesIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.GetLeasesIDOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*operations.GetLeasesIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.GetLeasesIDOK); ok { + r0 = rf(params, authInfo, opts...) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*c_o_r_s.OptionsLeasesIDOK) + r0 = ret.Get(0).(*operations.GetLeasesIDOK) } } + if rf, ok := ret.Get(1).(func(*operations.GetLeasesIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetUsage provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) GetUsage(params *operations.GetUsageParams, authInfo runtime.ClientAuthInfoWriter, opts ...operations.ClientOption) (*operations.GetUsageOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for GetUsage") + } + + var r0 *operations.GetUsageOK var r1 error - if rf, ok := ret.Get(1).(func(*c_o_r_s.OptionsLeasesIDParams) error); ok { - r1 = rf(params) + if rf, ok := ret.Get(0).(func(*operations.GetUsageParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.GetUsageOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*operations.GetUsageParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.GetUsageOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*operations.GetUsageOK) + } + } + + if rf, ok := ret.Get(1).(func(*operations.GetUsageParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) } else { r1 = ret.Error(1) } @@ -172,22 +384,73 @@ func (_m *ClientService) OptionsLeasesID(params *c_o_r_s.OptionsLeasesIDParams) return r0, r1 } -// OptionsLeasesIDAuth provides a mock function with given fields: params -func (_m *ClientService) OptionsLeasesIDAuth(params *c_o_r_s.OptionsLeasesIDAuthParams) (*c_o_r_s.OptionsLeasesIDAuthOK, error) { - ret := _m.Called(params) +// PostAccounts provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) PostAccounts(params *operations.PostAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...operations.ClientOption) (*operations.PostAccountsCreated, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) - var r0 *c_o_r_s.OptionsLeasesIDAuthOK - if rf, ok := ret.Get(0).(func(*c_o_r_s.OptionsLeasesIDAuthParams) *c_o_r_s.OptionsLeasesIDAuthOK); ok { - r0 = rf(params) + if len(ret) == 0 { + panic("no return value specified for PostAccounts") + } + + var r0 *operations.PostAccountsCreated + var r1 error + if rf, ok := ret.Get(0).(func(*operations.PostAccountsParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.PostAccountsCreated, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*operations.PostAccountsParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.PostAccountsCreated); ok { + r0 = rf(params, authInfo, opts...) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*c_o_r_s.OptionsLeasesIDAuthOK) + r0 = ret.Get(0).(*operations.PostAccountsCreated) } } + if rf, ok := ret.Get(1).(func(*operations.PostAccountsParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// PostLeases provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) PostLeases(params *operations.PostLeasesParams, authInfo runtime.ClientAuthInfoWriter, opts ...operations.ClientOption) (*operations.PostLeasesCreated, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for PostLeases") + } + + var r0 *operations.PostLeasesCreated var r1 error - if rf, ok := ret.Get(1).(func(*c_o_r_s.OptionsLeasesIDAuthParams) error); ok { - r1 = rf(params) + if rf, ok := ret.Get(0).(func(*operations.PostLeasesParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.PostLeasesCreated, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*operations.PostLeasesParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.PostLeasesCreated); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*operations.PostLeasesCreated) + } + } + + if rf, ok := ret.Get(1).(func(*operations.PostLeasesParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) } else { r1 = ret.Error(1) } @@ -195,22 +458,73 @@ func (_m *ClientService) OptionsLeasesIDAuth(params *c_o_r_s.OptionsLeasesIDAuth return r0, r1 } -// OptionsUsage provides a mock function with given fields: params -func (_m *ClientService) OptionsUsage(params *c_o_r_s.OptionsUsageParams) (*c_o_r_s.OptionsUsageOK, error) { - ret := _m.Called(params) +// PostLeasesIDAuth provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) PostLeasesIDAuth(params *operations.PostLeasesIDAuthParams, authInfo runtime.ClientAuthInfoWriter, opts ...operations.ClientOption) (*operations.PostLeasesIDAuthCreated, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) - var r0 *c_o_r_s.OptionsUsageOK - if rf, ok := ret.Get(0).(func(*c_o_r_s.OptionsUsageParams) *c_o_r_s.OptionsUsageOK); ok { - r0 = rf(params) + if len(ret) == 0 { + panic("no return value specified for PostLeasesIDAuth") + } + + var r0 *operations.PostLeasesIDAuthCreated + var r1 error + if rf, ok := ret.Get(0).(func(*operations.PostLeasesIDAuthParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.PostLeasesIDAuthCreated, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*operations.PostLeasesIDAuthParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.PostLeasesIDAuthCreated); ok { + r0 = rf(params, authInfo, opts...) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*c_o_r_s.OptionsUsageOK) + r0 = ret.Get(0).(*operations.PostLeasesIDAuthCreated) } } + if rf, ok := ret.Get(1).(func(*operations.PostLeasesIDAuthParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// PutAccountsID provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) PutAccountsID(params *operations.PutAccountsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...operations.ClientOption) (*operations.PutAccountsIDOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for PutAccountsID") + } + + var r0 *operations.PutAccountsIDOK var r1 error - if rf, ok := ret.Get(1).(func(*c_o_r_s.OptionsUsageParams) error); ok { - r1 = rf(params) + if rf, ok := ret.Get(0).(func(*operations.PutAccountsIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) (*operations.PutAccountsIDOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*operations.PutAccountsIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) *operations.PutAccountsIDOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*operations.PutAccountsIDOK) + } + } + + if rf, ok := ret.Get(1).(func(*operations.PutAccountsIDParams, runtime.ClientAuthInfoWriter, ...operations.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) } else { r1 = ret.Error(1) } @@ -222,3 +536,17 @@ func (_m *ClientService) OptionsUsage(params *c_o_r_s.OptionsUsageParams) (*c_o_ func (_m *ClientService) SetTransport(transport runtime.ClientTransport) { _m.Called(transport) } + +// NewClientService creates a new instance of ClientService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewClientService(t interface { + mock.TestingT + Cleanup(func()) +}) *ClientService { + mock := &ClientService{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/Deployer.go b/mocks/Deployer.go index bdca72f..6c51e57 100644 --- a/mocks/Deployer.go +++ b/mocks/Deployer.go @@ -1,9 +1,11 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks -import mock "github.com/stretchr/testify/mock" -import service "github.com/Optum/dce-cli/pkg/service" +import ( + service "github.com/Optum/dce-cli/pkg/service" + mock "github.com/stretchr/testify/mock" +) // Deployer is an autogenerated mock type for the Deployer type type Deployer struct { @@ -14,6 +16,10 @@ type Deployer struct { func (_m *Deployer) Deploy(input *service.DeployConfig) error { ret := _m.Called(input) + if len(ret) == 0 { + panic("no return value specified for Deploy") + } + var r0 error if rf, ok := ret.Get(0).(func(*service.DeployConfig) error); ok { r0 = rf(input) @@ -28,6 +34,10 @@ func (_m *Deployer) Deploy(input *service.DeployConfig) error { func (_m *Deployer) PostDeploy(input *service.DeployConfig) error { ret := _m.Called(input) + if len(ret) == 0 { + panic("no return value specified for PostDeploy") + } + var r0 error if rf, ok := ret.Get(0).(func(*service.DeployConfig) error); ok { r0 = rf(input) @@ -37,3 +47,17 @@ func (_m *Deployer) PostDeploy(input *service.DeployConfig) error { return r0 } + +// NewDeployer creates a new instance of Deployer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewDeployer(t interface { + mock.TestingT + Cleanup(func()) +}) *Deployer { + mock := &Deployer{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/Durationer.go b/mocks/Durationer.go index 94dd50e..18bd9f5 100644 --- a/mocks/Durationer.go +++ b/mocks/Durationer.go @@ -1,9 +1,12 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks -import mock "github.com/stretchr/testify/mock" -import time "time" +import ( + time "time" + + mock "github.com/stretchr/testify/mock" +) // Durationer is an autogenerated mock type for the Durationer type type Durationer struct { @@ -14,14 +17,21 @@ type Durationer struct { func (_m *Durationer) ExpandEpochTime(str string) (int64, error) { ret := _m.Called(str) + if len(ret) == 0 { + panic("no return value specified for ExpandEpochTime") + } + var r0 int64 + var r1 error + if rf, ok := ret.Get(0).(func(string) (int64, error)); ok { + return rf(str) + } if rf, ok := ret.Get(0).(func(string) int64); ok { r0 = rf(str) } else { r0 = ret.Get(0).(int64) } - var r1 error if rf, ok := ret.Get(1).(func(string) error); ok { r1 = rf(str) } else { @@ -35,14 +45,21 @@ func (_m *Durationer) ExpandEpochTime(str string) (int64, error) { func (_m *Durationer) ParseDuration(str string) (time.Duration, error) { ret := _m.Called(str) + if len(ret) == 0 { + panic("no return value specified for ParseDuration") + } + var r0 time.Duration + var r1 error + if rf, ok := ret.Get(0).(func(string) (time.Duration, error)); ok { + return rf(str) + } if rf, ok := ret.Get(0).(func(string) time.Duration); ok { r0 = rf(str) } else { r0 = ret.Get(0).(time.Duration) } - var r1 error if rf, ok := ret.Get(1).(func(string) error); ok { r1 = rf(str) } else { @@ -51,3 +68,17 @@ func (_m *Durationer) ParseDuration(str string) (time.Duration, error) { return r0, r1 } + +// NewDurationer creates a new instance of Durationer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewDurationer(t interface { + mock.TestingT + Cleanup(func()) +}) *Durationer { + mock := &Durationer{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/FileSystemer.go b/mocks/FileSystemer.go index a2a18f6..bc59a7d 100644 --- a/mocks/FileSystemer.go +++ b/mocks/FileSystemer.go @@ -1,9 +1,13 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks -import mock "github.com/stretchr/testify/mock" -import os "os" +import ( + fs "io/fs" + os "os" + + mock "github.com/stretchr/testify/mock" +) // FileSystemer is an autogenerated mock type for the FileSystemer type type FileSystemer struct { @@ -14,14 +18,21 @@ type FileSystemer struct { func (_m *FileSystemer) ChToConfigDir() (string, string) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ChToConfigDir") + } + var r0 string + var r1 string + if rf, ok := ret.Get(0).(func() (string, string)); ok { + return rf() + } if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() } else { r0 = ret.Get(0).(string) } - var r1 string if rf, ok := ret.Get(1).(func() string); ok { r1 = rf() } else { @@ -35,14 +46,21 @@ func (_m *FileSystemer) ChToConfigDir() (string, string) { func (_m *FileSystemer) ChToTmpDir() (string, string) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ChToTmpDir") + } + var r0 string + var r1 string + if rf, ok := ret.Get(0).(func() (string, string)); ok { + return rf() + } if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() } else { r0 = ret.Get(0).(string) } - var r1 string if rf, ok := ret.Get(1).(func() string); ok { r1 = rf() } else { @@ -61,6 +79,10 @@ func (_m *FileSystemer) Chdir(path string) { func (_m *FileSystemer) CreateConfigDirTree(dceVersion string) error { ret := _m.Called(dceVersion) + if len(ret) == 0 { + panic("no return value specified for CreateConfigDirTree") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(dceVersion) @@ -75,6 +97,10 @@ func (_m *FileSystemer) CreateConfigDirTree(dceVersion string) error { func (_m *FileSystemer) GetArtifactsDir(dceVersion string) string { ret := _m.Called(dceVersion) + if len(ret) == 0 { + panic("no return value specified for GetArtifactsDir") + } + var r0 string if rf, ok := ret.Get(0).(func(string) string); ok { r0 = rf(dceVersion) @@ -89,6 +115,10 @@ func (_m *FileSystemer) GetArtifactsDir(dceVersion string) string { func (_m *FileSystemer) GetCacheDir() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetCacheDir") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -103,6 +133,10 @@ func (_m *FileSystemer) GetCacheDir() string { func (_m *FileSystemer) GetConfigDir() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetConfigDir") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -117,6 +151,10 @@ func (_m *FileSystemer) GetConfigDir() string { func (_m *FileSystemer) GetConfigFile() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetConfigFile") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -131,6 +169,10 @@ func (_m *FileSystemer) GetConfigFile() string { func (_m *FileSystemer) GetHomeDir() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetHomeDir") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -145,6 +187,10 @@ func (_m *FileSystemer) GetHomeDir() string { func (_m *FileSystemer) GetLocalMainTFFile() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetLocalMainTFFile") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -159,6 +205,10 @@ func (_m *FileSystemer) GetLocalMainTFFile() string { func (_m *FileSystemer) GetLocalTFModuleDir() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetLocalTFModuleDir") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -173,6 +223,10 @@ func (_m *FileSystemer) GetLocalTFModuleDir() string { func (_m *FileSystemer) GetLogFile() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetLogFile") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -187,6 +241,10 @@ func (_m *FileSystemer) GetLogFile() string { func (_m *FileSystemer) GetTerraformBin() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetTerraformBin") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -201,6 +259,10 @@ func (_m *FileSystemer) GetTerraformBin() string { func (_m *FileSystemer) GetTerraformBinDir() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetTerraformBinDir") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -215,6 +277,10 @@ func (_m *FileSystemer) GetTerraformBinDir() string { func (_m *FileSystemer) GetTerraformStateFile() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetTerraformStateFile") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -229,6 +295,10 @@ func (_m *FileSystemer) GetTerraformStateFile() string { func (_m *FileSystemer) IsExistingFile(path string) bool { ret := _m.Called(path) + if len(ret) == 0 { + panic("no return value specified for IsExistingFile") + } + var r0 bool if rf, ok := ret.Get(0).(func(string) bool); ok { r0 = rf(path) @@ -243,7 +313,15 @@ func (_m *FileSystemer) IsExistingFile(path string) bool { func (_m *FileSystemer) OpenFileWriter(path string) (*os.File, error) { ret := _m.Called(path) + if len(ret) == 0 { + panic("no return value specified for OpenFileWriter") + } + var r0 *os.File + var r1 error + if rf, ok := ret.Get(0).(func(string) (*os.File, error)); ok { + return rf(path) + } if rf, ok := ret.Get(0).(func(string) *os.File); ok { r0 = rf(path) } else { @@ -252,7 +330,6 @@ func (_m *FileSystemer) OpenFileWriter(path string) (*os.File, error) { } } - var r1 error if rf, ok := ret.Get(1).(func(string) error); ok { r1 = rf(path) } else { @@ -263,15 +340,19 @@ func (_m *FileSystemer) OpenFileWriter(path string) (*os.File, error) { } // ReadDir provides a mock function with given fields: path -func (_m *FileSystemer) ReadDir(path string) []os.FileInfo { +func (_m *FileSystemer) ReadDir(path string) []fs.FileInfo { ret := _m.Called(path) - var r0 []os.FileInfo - if rf, ok := ret.Get(0).(func(string) []os.FileInfo); ok { + if len(ret) == 0 { + panic("no return value specified for ReadDir") + } + + var r0 []fs.FileInfo + if rf, ok := ret.Get(0).(func(string) []fs.FileInfo); ok { r0 = rf(path) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]os.FileInfo) + r0 = ret.Get(0).([]fs.FileInfo) } } @@ -282,6 +363,10 @@ func (_m *FileSystemer) ReadDir(path string) []os.FileInfo { func (_m *FileSystemer) ReadFromFile(path string) string { ret := _m.Called(path) + if len(ret) == 0 { + panic("no return value specified for ReadFromFile") + } + var r0 string if rf, ok := ret.Get(0).(func(string) string); ok { r0 = rf(path) @@ -296,6 +381,10 @@ func (_m *FileSystemer) ReadFromFile(path string) string { func (_m *FileSystemer) ReadInConfig() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ReadInConfig") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -315,6 +404,10 @@ func (_m *FileSystemer) RemoveAll(path string) { func (_m *FileSystemer) Unarchive(source string, destination string) error { ret := _m.Called(source, destination) + if len(ret) == 0 { + panic("no return value specified for Unarchive") + } + var r0 error if rf, ok := ret.Get(0).(func(string, string) error); ok { r0 = rf(source, destination) @@ -329,6 +422,10 @@ func (_m *FileSystemer) Unarchive(source string, destination string) error { func (_m *FileSystemer) WriteConfig() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for WriteConfig") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -343,3 +440,17 @@ func (_m *FileSystemer) WriteConfig() error { func (_m *FileSystemer) WriteFile(fileName string, data string) { _m.Called(fileName, data) } + +// NewFileSystemer creates a new instance of FileSystemer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewFileSystemer(t interface { + mock.TestingT + Cleanup(func()) +}) *FileSystemer { + mock := &FileSystemer{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/Githuber.go b/mocks/Githuber.go index c7453fa..d44d6fd 100644 --- a/mocks/Githuber.go +++ b/mocks/Githuber.go @@ -1,4 +1,4 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks @@ -13,6 +13,10 @@ type Githuber struct { func (_m *Githuber) DownloadGithubReleaseAsset(assetName string, dceVersion string) error { ret := _m.Called(assetName, dceVersion) + if len(ret) == 0 { + panic("no return value specified for DownloadGithubReleaseAsset") + } + var r0 error if rf, ok := ret.Get(0).(func(string, string) error); ok { r0 = rf(assetName, dceVersion) @@ -22,3 +26,17 @@ func (_m *Githuber) DownloadGithubReleaseAsset(assetName string, dceVersion stri return r0 } + +// NewGithuber creates a new instance of Githuber. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewGithuber(t interface { + mock.TestingT + Cleanup(func()) +}) *Githuber { + mock := &Githuber{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/Initer.go b/mocks/Initer.go index 35f5418..d1fce51 100644 --- a/mocks/Initer.go +++ b/mocks/Initer.go @@ -1,4 +1,4 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks @@ -13,3 +13,17 @@ type Initer struct { func (_m *Initer) InitializeDCE() { _m.Called() } + +// NewIniter creates a new instance of Initer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewIniter(t interface { + mock.TestingT + Cleanup(func()) +}) *Initer { + mock := &Initer{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/Leaser.go b/mocks/Leaser.go index d418b51..9ca7ab4 100644 --- a/mocks/Leaser.go +++ b/mocks/Leaser.go @@ -1,9 +1,11 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks -import mock "github.com/stretchr/testify/mock" -import service "github.com/Optum/dce-cli/pkg/service" +import ( + service "github.com/Optum/dce-cli/pkg/service" + mock "github.com/stretchr/testify/mock" +) // Leaser is an autogenerated mock type for the Leaser type type Leaser struct { @@ -15,9 +17,9 @@ func (_m *Leaser) CreateLease(principalID string, budgetAmount float64, budgetCu _m.Called(principalID, budgetAmount, budgetCurrency, email, expiresOn) } -// EndLease provides a mock function with given fields: accountID, principalID -func (_m *Leaser) EndLease(accountID string, principalID string) { - _m.Called(accountID, principalID) +// EndLease provides a mock function with given fields: leaseID, accountID, principalID +func (_m *Leaser) EndLease(leaseID string, accountID string, principalID string) { + _m.Called(leaseID, accountID, principalID) } // GetLease provides a mock function with given fields: leaseID @@ -39,3 +41,17 @@ func (_m *Leaser) Login(opts *service.LeaseLoginOptions) { func (_m *Leaser) LoginByID(leaseID string, opts *service.LeaseLoginOptions) { _m.Called(leaseID, opts) } + +// NewLeaser creates a new instance of Leaser. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewLeaser(t interface { + mock.TestingT + Cleanup(func()) +}) *Leaser { + mock := &Leaser{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/LevelLogger.go b/mocks/LevelLogger.go index ad94ce5..a5b80f7 100644 --- a/mocks/LevelLogger.go +++ b/mocks/LevelLogger.go @@ -1,4 +1,4 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks @@ -140,3 +140,17 @@ func (_m *LevelLogger) Warnln(args ...interface{}) { _ca = append(_ca, args...) _m.Called(_ca...) } + +// NewLevelLogger creates a new instance of LevelLogger. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewLevelLogger(t interface { + mock.TestingT + Cleanup(func()) +}) *LevelLogger { + mock := &LevelLogger{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/Logger.go b/mocks/Logger.go index f9b76cf..1a98242 100644 --- a/mocks/Logger.go +++ b/mocks/Logger.go @@ -1,4 +1,4 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks @@ -162,3 +162,17 @@ func (_m *Logger) Warnln(args ...interface{}) { _ca = append(_ca, args...) _m.Called(_ca...) } + +// NewLogger creates a new instance of Logger. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewLogger(t interface { + mock.TestingT + Cleanup(func()) +}) *Logger { + mock := &Logger{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/OutputWriter.go b/mocks/OutputWriter.go index f32a14a..5d634c6 100644 --- a/mocks/OutputWriter.go +++ b/mocks/OutputWriter.go @@ -1,4 +1,4 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks @@ -13,14 +13,21 @@ type OutputWriter struct { func (_m *OutputWriter) Write(p []byte) (int, error) { ret := _m.Called(p) + if len(ret) == 0 { + panic("no return value specified for Write") + } + var r0 int + var r1 error + if rf, ok := ret.Get(0).(func([]byte) (int, error)); ok { + return rf(p) + } if rf, ok := ret.Get(0).(func([]byte) int); ok { r0 = rf(p) } else { r0 = ret.Get(0).(int) } - var r1 error if rf, ok := ret.Get(1).(func([]byte) error); ok { r1 = rf(p) } else { @@ -29,3 +36,17 @@ func (_m *OutputWriter) Write(p []byte) (int, error) { return r0, r1 } + +// NewOutputWriter creates a new instance of OutputWriter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewOutputWriter(t interface { + mock.TestingT + Cleanup(func()) +}) *OutputWriter { + mock := &OutputWriter{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/Prompter.go b/mocks/Prompter.go index 8b5f9ae..70ad675 100644 --- a/mocks/Prompter.go +++ b/mocks/Prompter.go @@ -1,4 +1,4 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks @@ -13,6 +13,10 @@ type Prompter struct { func (_m *Prompter) PromptBasic(label string, validator func(string) error) *string { ret := _m.Called(label, validator) + if len(ret) == 0 { + panic("no return value specified for PromptBasic") + } + var r0 *string if rf, ok := ret.Get(0).(func(string, func(string) error) *string); ok { r0 = rf(label, validator) @@ -25,18 +29,16 @@ func (_m *Prompter) PromptBasic(label string, validator func(string) error) *str return r0 } -// PromptSelect provides a mock function with given fields: label, items -func (_m *Prompter) PromptSelect(label string, items []string) *string { - ret := _m.Called(label, items) +// NewPrompter creates a new instance of Prompter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewPrompter(t interface { + mock.TestingT + Cleanup(func()) +}) *Prompter { + mock := &Prompter{} + mock.Mock.Test(t) - var r0 *string - if rf, ok := ret.Get(0).(func(string, []string) *string); ok { - r0 = rf(label, items) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*string) - } - } + t.Cleanup(func() { mock.AssertExpectations(t) }) - return r0 + return mock } diff --git a/mocks/TFTemplater.go b/mocks/TFTemplater.go index 3dfcc06..d05ca01 100644 --- a/mocks/TFTemplater.go +++ b/mocks/TFTemplater.go @@ -1,9 +1,12 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks -import io "io" -import mock "github.com/stretchr/testify/mock" +import ( + io "io" + + mock "github.com/stretchr/testify/mock" +) // TFTemplater is an autogenerated mock type for the TFTemplater type type TFTemplater struct { @@ -14,6 +17,10 @@ type TFTemplater struct { func (_m *TFTemplater) AddVariable(name string, vartype string, vardefault string) error { ret := _m.Called(name, vartype, vardefault) + if len(ret) == 0 { + panic("no return value specified for AddVariable") + } + var r0 error if rf, ok := ret.Get(0).(func(string, string, string) error); ok { r0 = rf(name, vartype, vardefault) @@ -33,6 +40,10 @@ func (_m *TFTemplater) SetModuleSource(source string) { func (_m *TFTemplater) Write(w io.Writer) error { ret := _m.Called(w) + if len(ret) == 0 { + panic("no return value specified for Write") + } + var r0 error if rf, ok := ret.Get(0).(func(io.Writer) error); ok { r0 = rf(w) @@ -42,3 +53,17 @@ func (_m *TFTemplater) Write(w io.Writer) error { return r0 } + +// NewTFTemplater creates a new instance of TFTemplater. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewTFTemplater(t interface { + mock.TestingT + Cleanup(func()) +}) *TFTemplater { + mock := &TFTemplater{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/TerraformBinDownloader.go b/mocks/TerraformBinDownloader.go index 951464f..80bd6c9 100644 --- a/mocks/TerraformBinDownloader.go +++ b/mocks/TerraformBinDownloader.go @@ -1,4 +1,4 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks @@ -13,6 +13,10 @@ type TerraformBinDownloader struct { func (_m *TerraformBinDownloader) Download(url string, localpath string) error { ret := _m.Called(url, localpath) + if len(ret) == 0 { + panic("no return value specified for Download") + } + var r0 error if rf, ok := ret.Get(0).(func(string, string) error); ok { r0 = rf(url, localpath) @@ -22,3 +26,17 @@ func (_m *TerraformBinDownloader) Download(url string, localpath string) error { return r0 } + +// NewTerraformBinDownloader creates a new instance of TerraformBinDownloader. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewTerraformBinDownloader(t interface { + mock.TestingT + Cleanup(func()) +}) *TerraformBinDownloader { + mock := &TerraformBinDownloader{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/TerraformBinFileSystemUtil.go b/mocks/TerraformBinFileSystemUtil.go index d3719f3..df2befa 100644 --- a/mocks/TerraformBinFileSystemUtil.go +++ b/mocks/TerraformBinFileSystemUtil.go @@ -1,9 +1,12 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks -import mock "github.com/stretchr/testify/mock" -import os "os" +import ( + os "os" + + mock "github.com/stretchr/testify/mock" +) // TerraformBinFileSystemUtil is an autogenerated mock type for the TerraformBinFileSystemUtil type type TerraformBinFileSystemUtil struct { @@ -14,6 +17,10 @@ type TerraformBinFileSystemUtil struct { func (_m *TerraformBinFileSystemUtil) GetConfigDir() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetConfigDir") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -28,6 +35,10 @@ func (_m *TerraformBinFileSystemUtil) GetConfigDir() string { func (_m *TerraformBinFileSystemUtil) GetLocalTFModuleDir() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetLocalTFModuleDir") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -42,6 +53,10 @@ func (_m *TerraformBinFileSystemUtil) GetLocalTFModuleDir() string { func (_m *TerraformBinFileSystemUtil) GetTerraformBin() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetTerraformBin") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -56,6 +71,10 @@ func (_m *TerraformBinFileSystemUtil) GetTerraformBin() string { func (_m *TerraformBinFileSystemUtil) GetTerraformBinDir() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetTerraformBinDir") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -70,6 +89,10 @@ func (_m *TerraformBinFileSystemUtil) GetTerraformBinDir() string { func (_m *TerraformBinFileSystemUtil) IsExistingFile(path string) bool { ret := _m.Called(path) + if len(ret) == 0 { + panic("no return value specified for IsExistingFile") + } + var r0 bool if rf, ok := ret.Get(0).(func(string) bool); ok { r0 = rf(path) @@ -84,7 +107,15 @@ func (_m *TerraformBinFileSystemUtil) IsExistingFile(path string) bool { func (_m *TerraformBinFileSystemUtil) OpenFileWriter(path string) (*os.File, error) { ret := _m.Called(path) + if len(ret) == 0 { + panic("no return value specified for OpenFileWriter") + } + var r0 *os.File + var r1 error + if rf, ok := ret.Get(0).(func(string) (*os.File, error)); ok { + return rf(path) + } if rf, ok := ret.Get(0).(func(string) *os.File); ok { r0 = rf(path) } else { @@ -93,7 +124,6 @@ func (_m *TerraformBinFileSystemUtil) OpenFileWriter(path string) (*os.File, err } } - var r1 error if rf, ok := ret.Get(1).(func(string) error); ok { r1 = rf(path) } else { @@ -112,6 +142,10 @@ func (_m *TerraformBinFileSystemUtil) RemoveAll(path string) { func (_m *TerraformBinFileSystemUtil) Unarchive(source string, destination string) error { ret := _m.Called(source, destination) + if len(ret) == 0 { + panic("no return value specified for Unarchive") + } + var r0 error if rf, ok := ret.Get(0).(func(string, string) error); ok { r0 = rf(source, destination) @@ -121,3 +155,17 @@ func (_m *TerraformBinFileSystemUtil) Unarchive(source string, destination strin return r0 } + +// NewTerraformBinFileSystemUtil creates a new instance of TerraformBinFileSystemUtil. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewTerraformBinFileSystemUtil(t interface { + mock.TestingT + Cleanup(func()) +}) *TerraformBinFileSystemUtil { + mock := &TerraformBinFileSystemUtil{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/Terraformer.go b/mocks/Terraformer.go index 941b1b9..2aac50c 100644 --- a/mocks/Terraformer.go +++ b/mocks/Terraformer.go @@ -1,9 +1,12 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks -import context "context" -import mock "github.com/stretchr/testify/mock" +import ( + context "context" + + mock "github.com/stretchr/testify/mock" +) // Terraformer is an autogenerated mock type for the Terraformer type type Terraformer struct { @@ -14,6 +17,10 @@ type Terraformer struct { func (_m *Terraformer) Apply(ctx context.Context, args []string) error { ret := _m.Called(ctx, args) + if len(ret) == 0 { + panic("no return value specified for Apply") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, []string) error); ok { r0 = rf(ctx, args) @@ -28,14 +35,21 @@ func (_m *Terraformer) Apply(ctx context.Context, args []string) error { func (_m *Terraformer) GetOutput(ctx context.Context, key string) (string, error) { ret := _m.Called(ctx, key) + if len(ret) == 0 { + panic("no return value specified for GetOutput") + } + var r0 string + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (string, error)); ok { + return rf(ctx, key) + } if rf, ok := ret.Get(0).(func(context.Context, string) string); ok { r0 = rf(ctx, key) } else { r0 = ret.Get(0).(string) } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { r1 = rf(ctx, key) } else { @@ -49,6 +63,10 @@ func (_m *Terraformer) GetOutput(ctx context.Context, key string) (string, error func (_m *Terraformer) Init(ctx context.Context, args []string) error { ret := _m.Called(ctx, args) + if len(ret) == 0 { + panic("no return value specified for Init") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, []string) error); ok { r0 = rf(ctx, args) @@ -58,3 +76,17 @@ func (_m *Terraformer) Init(ctx context.Context, args []string) error { return r0 } + +// NewTerraformer creates a new instance of Terraformer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewTerraformer(t interface { + mock.TestingT + Cleanup(func()) +}) *Terraformer { + mock := &Terraformer{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/Usager.go b/mocks/Usager.go index bc29c6e..ad3262d 100644 --- a/mocks/Usager.go +++ b/mocks/Usager.go @@ -1,4 +1,4 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks @@ -13,3 +13,17 @@ type Usager struct { func (_m *Usager) GetUsage(startDate float64, endDate float64) { _m.Called(startDate, endDate) } + +// NewUsager creates a new instance of Usager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewUsager(t interface { + mock.TestingT + Cleanup(func()) +}) *Usager { + mock := &Usager{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/Weber.go b/mocks/Weber.go index 80358b5..6ff721a 100644 --- a/mocks/Weber.go +++ b/mocks/Weber.go @@ -1,4 +1,4 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks @@ -13,3 +13,17 @@ type Weber struct { func (_m *Weber) OpenURL(url string) { _m.Called(url) } + +// NewWeber creates a new instance of Weber. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewWeber(t interface { + mock.TestingT + Cleanup(func()) +}) *Weber { + mock := &Weber{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/models/account.go b/models/account.go index 8cd1e2f..d5a8a0e 100644 --- a/models/account.go +++ b/models/account.go @@ -6,15 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Account Account Details +// // swagger:model account type Account struct { @@ -23,7 +25,7 @@ type Account struct { // "NotReady": The account is in "dirty" state, and needs to be reset before it may be leased. // "Leased": The account is leased to a principal // - // Enum: [Ready NotReady Leased Orphaned] + // Enum: ["Ready","NotReady","Leased","Orphaned"] AccountStatus string `json:"accountStatus,omitempty"` // ARN for an IAM role within this AWS account. The DCE master account will assume this IAM role to execute operations within this AWS account. This IAM role is configured by the client, and must be configured with [a Trust Relationship with the DCE master account.](/https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_cross-account-with-roles.html) @@ -91,14 +93,13 @@ const ( // prop value enum func (m *Account) validateAccountStatusEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, accountTypeAccountStatusPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, accountTypeAccountStatusPropEnum, true); err != nil { return err } return nil } func (m *Account) validateAccountStatus(formats strfmt.Registry) error { - if swag.IsZero(m.AccountStatus) { // not required return nil } @@ -111,6 +112,11 @@ func (m *Account) validateAccountStatus(formats strfmt.Registry) error { return nil } +// ContextValidate validates this account based on context it is used +func (m *Account) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Account) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/account_status.go b/models/account_status.go index 90c240d..c6c84dd 100644 --- a/models/account_status.go +++ b/models/account_status.go @@ -6,10 +6,11 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) @@ -21,6 +22,15 @@ import ( // swagger:model accountStatus type AccountStatus string +func NewAccountStatus(value AccountStatus) *AccountStatus { + return &value +} + +// Pointer returns a pointer to a freshly-allocated AccountStatus. +func (m AccountStatus) Pointer() *AccountStatus { + return &m +} + const ( // AccountStatusReady captures enum value "Ready" @@ -50,7 +60,7 @@ func init() { } func (m AccountStatus) validateAccountStatusEnum(path, location string, value AccountStatus) error { - if err := validate.Enum(path, location, value, accountStatusEnum); err != nil { + if err := validate.EnumCase(path, location, value, accountStatusEnum, true); err != nil { return err } return nil @@ -70,3 +80,8 @@ func (m AccountStatus) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validates this account status based on context it is used +func (m AccountStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/models/lease.go b/models/lease.go index 11d5b2d..98e267e 100644 --- a/models/lease.go +++ b/models/lease.go @@ -6,15 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Lease Lease Details +// // swagger:model lease type Lease struct { @@ -46,7 +48,7 @@ type Lease struct { // "Active": The principal is leased and has access to the account // "Inactive": The lease has become inactive, either through expiring, exceeding budget, or by request. // - // Enum: [Active Inactive] + // Enum: ["Active","Inactive"] LeaseStatus string `json:"leaseStatus,omitempty"` // date lease status was last modified in epoch seconds @@ -63,7 +65,7 @@ type Lease struct { // "LeaseRolledBack": A system error occurred while provisioning the lease. // and it was rolled back. // - // Enum: [LeaseExpired LeaseOverBudget LeaseDestroyed LeaseActive LeaseRolledBack] + // Enum: ["LeaseExpired","LeaseOverBudget","LeaseDestroyed","LeaseActive","LeaseRolledBack"] LeaseStatusReason string `json:"leaseStatusReason,omitempty"` // principalId of the lease to get @@ -111,14 +113,13 @@ const ( // prop value enum func (m *Lease) validateLeaseStatusEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, leaseTypeLeaseStatusPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, leaseTypeLeaseStatusPropEnum, true); err != nil { return err } return nil } func (m *Lease) validateLeaseStatus(formats strfmt.Registry) error { - if swag.IsZero(m.LeaseStatus) { // not required return nil } @@ -163,14 +164,13 @@ const ( // prop value enum func (m *Lease) validateLeaseStatusReasonEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, leaseTypeLeaseStatusReasonPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, leaseTypeLeaseStatusReasonPropEnum, true); err != nil { return err } return nil } func (m *Lease) validateLeaseStatusReason(formats strfmt.Registry) error { - if swag.IsZero(m.LeaseStatusReason) { // not required return nil } @@ -183,6 +183,11 @@ func (m *Lease) validateLeaseStatusReason(formats strfmt.Registry) error { return nil } +// ContextValidate validates this lease based on context it is used +func (m *Lease) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Lease) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/lease_auth.go b/models/lease_auth.go index ec1fea4..54a2a5f 100644 --- a/models/lease_auth.go +++ b/models/lease_auth.go @@ -6,11 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // LeaseAuth Lease Authentication +// // swagger:model leaseAuth type LeaseAuth struct { @@ -20,9 +23,6 @@ type LeaseAuth struct { // URL to access the AWS Console ConsoleURL string `json:"consoleUrl,omitempty"` - // expires on - ExpiresOn float64 `json:"expiresOn,omitempty"` - // Secret Access Key for access to the AWS API SecretAccessKey string `json:"secretAccessKey,omitempty"` @@ -35,6 +35,11 @@ func (m *LeaseAuth) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this lease auth based on context it is used +func (m *LeaseAuth) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *LeaseAuth) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/models/lease_status.go b/models/lease_status.go index 0c4333d..d4617ab 100644 --- a/models/lease_status.go +++ b/models/lease_status.go @@ -6,10 +6,11 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) @@ -20,6 +21,15 @@ import ( // swagger:model leaseStatus type LeaseStatus string +func NewLeaseStatus(value LeaseStatus) *LeaseStatus { + return &value +} + +// Pointer returns a pointer to a freshly-allocated LeaseStatus. +func (m LeaseStatus) Pointer() *LeaseStatus { + return &m +} + const ( // LeaseStatusActive captures enum value "Active" @@ -43,7 +53,7 @@ func init() { } func (m LeaseStatus) validateLeaseStatusEnum(path, location string, value LeaseStatus) error { - if err := validate.Enum(path, location, value, leaseStatusEnum); err != nil { + if err := validate.EnumCase(path, location, value, leaseStatusEnum, true); err != nil { return err } return nil @@ -63,3 +73,8 @@ func (m LeaseStatus) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validates this lease status based on context it is used +func (m LeaseStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/models/lease_status_reason.go b/models/lease_status_reason.go index fb06f0a..54ecfb5 100644 --- a/models/lease_status_reason.go +++ b/models/lease_status_reason.go @@ -6,10 +6,11 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "github.com/go-openapi/errors" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) @@ -27,6 +28,15 @@ import ( // swagger:model leaseStatusReason type LeaseStatusReason string +func NewLeaseStatusReason(value LeaseStatusReason) *LeaseStatusReason { + return &value +} + +// Pointer returns a pointer to a freshly-allocated LeaseStatusReason. +func (m LeaseStatusReason) Pointer() *LeaseStatusReason { + return &m +} + const ( // LeaseStatusReasonLeaseExpired captures enum value "LeaseExpired" @@ -59,7 +69,7 @@ func init() { } func (m LeaseStatusReason) validateLeaseStatusReasonEnum(path, location string, value LeaseStatusReason) error { - if err := validate.Enum(path, location, value, leaseStatusReasonEnum); err != nil { + if err := validate.EnumCase(path, location, value, leaseStatusReasonEnum, true); err != nil { return err } return nil @@ -79,3 +89,8 @@ func (m LeaseStatusReason) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validates this lease status reason based on context it is used +func (m LeaseStatusReason) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/models/usage.go b/models/usage.go index 7bdc98a..18b68d7 100644 --- a/models/usage.go +++ b/models/usage.go @@ -6,13 +6,81 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // Usage usage cost of the aws account from start date to end date +// // swagger:model usage -type Usage struct { +type Usage []*UsageItems0 + +// Validate validates this usage +func (m Usage) Validate(formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + if swag.IsZero(m[i]) { // not required + continue + } + + if m[i] != nil { + if err := m[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this usage based on the context it is used +func (m Usage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + 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)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// UsageItems0 usage items0 +// +// swagger:model UsageItems0 +type UsageItems0 struct { // accountId of the AWS account AccountID string `json:"accountId,omitempty"` @@ -37,13 +105,18 @@ type Usage struct { TimeToLive float64 `json:"timeToLive,omitempty"` } -// Validate validates this usage -func (m *Usage) Validate(formats strfmt.Registry) error { +// Validate validates this usage items0 +func (m *UsageItems0) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this usage items0 based on context it is used +func (m *UsageItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation -func (m *Usage) MarshalBinary() ([]byte, error) { +func (m *UsageItems0) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } @@ -51,8 +124,8 @@ func (m *Usage) MarshalBinary() ([]byte, error) { } // UnmarshalBinary interface implementation -func (m *Usage) UnmarshalBinary(b []byte) error { - var res Usage +func (m *UsageItems0) UnmarshalBinary(b []byte) error { + var res UsageItems0 if err := swag.ReadJSON(b, &res); err != nil { return err } diff --git a/pkg/service/deploy.go b/pkg/service/deploy.go index 2e4da42..92315dd 100644 --- a/pkg/service/deploy.go +++ b/pkg/service/deploy.go @@ -229,7 +229,7 @@ func (s *DeployService) getLocalTFMainContents(deployConfig *DeployConfig) (stri func (s *DeployService) retrieveCodeAssets(dceLocation string, dceVersion string) (string, error) { tmpDir, oldDir := s.Util.ChToTmpDir() - defer os.Chdir(oldDir) //nolint,errcheck + defer os.Chdir(oldDir) //nolint:errcheck if strings.HasPrefix(dceLocation, "github.com") { // Download release assets from github diff --git a/pkg/service/leases.go b/pkg/service/leases.go index 149c9e5..ea20ee7 100644 --- a/pkg/service/leases.go +++ b/pkg/service/leases.go @@ -124,19 +124,18 @@ func (s *LeasesService) ListLeases(acctID, principalID, nextAcctID, nextPrincipa } type leaseCreds struct { - AccessKeyID string `json:"accessKeyId,omitempty"` - ConsoleURL string `json:"consoleUrl,omitempty"` - ExpiresOn float64 `json:"expiresOn,omitempty"` - SecretAccessKey string `json:"secretAccessKey,omitempty"` - SessionToken string `json:"sessionToken,omitempty"` + AccessKeyID string `json:"accessKeyId,omitempty"` + ConsoleURL string `json:"consoleUrl,omitempty"` + SecretAccessKey string `json:"secretAccessKey,omitempty"` + SessionToken string `json:"sessionToken,omitempty"` } func (s *LeasesService) Login(opts *LeaseLoginOptions) { log.Debugln("Requesting leased account credentials") - params := &operations.PostLeasesAuthParams{} + params := &operations.PostLeasesIDAuthParams{} params.SetTimeout(20 * time.Second) - res, err := ApiClient.PostLeasesAuth(params, nil) + res, err := ApiClient.PostLeasesIDAuth(params, nil) if err != nil { log.Fatal(err) diff --git a/pkg/service/service.go b/pkg/service/service.go index af46983..088fa03 100644 --- a/pkg/service/service.go +++ b/pkg/service/service.go @@ -58,6 +58,7 @@ type DeployOverrides struct { // Location of the DCE terraform module DCEModulePath string } + type Deployer interface { Deploy(input *DeployConfig) error PostDeploy(input *DeployConfig) error diff --git a/scripts/lint.sh b/scripts/lint.sh index a0c3998..9c9c81f 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -14,8 +14,3 @@ echo "done." echo -n "Linting golang code... " golangci-lint run echo "done." - - -echo -n "Scanning for securirty issues... " -gosec ./... -echo "done." diff --git a/tests/integration/cli_test_util.go b/tests/integration/cli_test_util.go index 5162fc8..3b1cc72 100644 --- a/tests/integration/cli_test_util.go +++ b/tests/integration/cli_test_util.go @@ -12,7 +12,7 @@ import ( "github.com/spf13/cobra" "github.com/stretchr/testify/require" "go.uber.org/thriftrw/ptr" - "io/ioutil" + "os" "testing" ) @@ -112,16 +112,17 @@ type injector func(input *injectorInput) // pointers to global services used by CLI commands // // eg -// cli.Inject(func(input *injectorInput) { -// input.util.Weber = &mocks.Weber{} -// }) +// +// cli.Inject(func(input *injectorInput) { +// input.util.Weber = &mocks.Weber{} +// }) func (test *cliTest) Inject(f injector) { test.injector = f } func writeTempConfig(t *testing.T, conf *configs.Root) string { // Create a tmp file - tmpfile, err := ioutil.TempFile("", "dce.*.yml") + tmpfile, err := os.CreateTemp("", "dce.*.yml") require.Nil(t, err) // Set default config diff --git a/tests/integration/deploy_test.go b/tests/integration/deploy_test.go index e7c099f..1fd3963 100644 --- a/tests/integration/deploy_test.go +++ b/tests/integration/deploy_test.go @@ -10,7 +10,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "io/ioutil" "log" "os" "path/filepath" @@ -28,7 +27,7 @@ func TestSystemDeployCommand(t *testing.T) { // Should use default version as TF module source ` module "dce" { - source="github.com/Optum/dce//modules?ref=v0.23.0"`, + source="github.com/Optum/dce//modules?ref=v0.38.0"`, ` output "artifacts_bucket_name" { description = "S3 bucket for artifacts like AWS Lambda code" @@ -244,7 +243,7 @@ type deployTest struct { func (test *deployTest) readConfigFile(t *testing.T, paths ...string) string { paths = append([]string{test.configDir}, paths...) fullPath := filepath.Join(paths...) - fileBytes, err := ioutil.ReadFile(fullPath) + fileBytes, err := os.ReadFile(fullPath) require.Nil(t, err) return string(fileBytes) } @@ -263,8 +262,7 @@ func newDeployTest(t *testing.T, config *configs.Root) *deployTest { // Mock the FileSystemer, to use a tmp dir for // generated terraform files - configDir, err := ioutil.TempDir("", ".dce-test-") - require.Nil(t, err) + configDir := os.TempDir() // Mock our Terraform wrapper util terraform := &mocks.Terraformer{} diff --git a/tests/integration/githuber.go b/tests/integration/githuber.go index 0b1e7b7..ccc5894 100644 --- a/tests/integration/githuber.go +++ b/tests/integration/githuber.go @@ -3,7 +3,7 @@ package integration import ( "fmt" "github.com/Optum/dce-cli/mocks" - "io/ioutil" + "os" "testing" ) @@ -34,7 +34,7 @@ func (gh *stubGithub) DownloadGithubReleaseAsset(assetName string, dceVersion st } // Write the file - // #nosec - err := ioutil.WriteFile(assetName, content, 0666) + //nolint:gosec + err := os.WriteFile(assetName, content, 0666) return err } diff --git a/tests/integration/init_test.go b/tests/integration/init_test.go index 3c96cd6..e2e772c 100644 --- a/tests/integration/init_test.go +++ b/tests/integration/init_test.go @@ -1,7 +1,6 @@ package integration import ( - "io/ioutil" "os" "path" "testing" @@ -32,9 +31,9 @@ func TestInitCommand(t *testing.T) { ) // Create a tmp dir for our config to live in - tmpdir, err := ioutil.TempDir("", "dce-cli-test") + tmpdir, err := os.MkdirTemp("", "dce-cli-test") require.Nil(t, err) - defer os.RemoveAll(tmpdir) + defer os.RemoveAll(tmpdir) //nolint:errcheck confFile := path.Join(tmpdir, "dce.yml") // Run `dce init` @@ -74,9 +73,9 @@ func TestInitCommand(t *testing.T) { ) // Create a tmp dir for our dce.yml config to live in - tmpdir, err := ioutil.TempDir("", "dce-cli-test") + tmpdir, err := os.MkdirTemp("", "dce-cli-test") require.Nil(t, err) - defer os.RemoveAll(tmpdir) + defer os.RemoveAll(tmpdir) //nolint:errcheck confFile := path.Join(tmpdir, "dce.yml") // Create empty dce.yml file @@ -151,12 +150,12 @@ func TestInitCommand(t *testing.T) { t.Run("THEN command fails", func(t *testing.T) { // Write some garbage to a file // Create a tmp file - tmpfile, err := ioutil.TempFile("", "dce.*.yml") + tmpfile, err := os.CreateTemp("", "dce.*.yml") require.Nil(t, err) - err = ioutil.WriteFile(tmpfile.Name(), []byte("not valid YAML"), 0644) + err = os.WriteFile(tmpfile.Name(), []byte("not valid YAML"), 0644) //nolint:gosec require.Nil(t, err) _ = tmpfile.Close() - defer os.Remove(tmpfile.Name()) + defer os.Remove(tmpfile.Name()) //nolint:errcheck // Run `dce init` (should fail) cli := NewCLITest(t) @@ -171,7 +170,7 @@ func TestInitCommand(t *testing.T) { } func assertYamlConfig(t *testing.T, expectedConf *configs.Root, yamlFile string) { - yamlStr, err := ioutil.ReadFile(yamlFile) + yamlStr, err := os.ReadFile(yamlFile) require.Nilf(t, err, "Failed to read %s", yamlFile) var actualConf configs.Root diff --git a/tests/integration/util.go b/tests/integration/util.go index 40322d3..e709a9a 100644 --- a/tests/integration/util.go +++ b/tests/integration/util.go @@ -5,7 +5,7 @@ import ( "bytes" "encoding/json" "github.com/stretchr/testify/require" - "io/ioutil" + "io" "os" "testing" ) @@ -32,7 +32,7 @@ func zipFiles(t *testing.T, files []file) []byte { err := w.Close() require.Nil(t, err) - zipBytes, err := ioutil.ReadAll(buf) + zipBytes, err := io.ReadAll(buf) require.Nil(t, err) return zipBytes diff --git a/tests/unit/config_test.go b/tests/unit/config_test.go index 841d185..6d2fefe 100644 --- a/tests/unit/config_test.go +++ b/tests/unit/config_test.go @@ -72,7 +72,7 @@ func TestCoalesce(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - if got := cfg.Coalesce(&tt.arg, &tt.config, &tt.envvar, &tt.def); *got != tt.want { + if got := cfg.Coalesce(&tt.arg, &tt.config, &tt.envvar, &tt.def); *got != tt.want { //nolint:gosec t.Errorf("Coalesce() = %v, want %v", got, tt.want) } }) diff --git a/tests/unit/login_test.go b/tests/unit/login_test.go index 6913a72..47afc37 100644 --- a/tests/unit/login_test.go +++ b/tests/unit/login_test.go @@ -100,32 +100,3 @@ func TestLeaseLoginGivenFlags(t *testing.T) { }) } } - -func TestLeaseLoginNoID(t *testing.T) { - initMocks(configs.Root{}) - - // Mock the `POST /leases/auth` endpoint - reqParams := &operations.PostLeasesAuthParams{} - reqParams.SetTimeout(20 * time.Second) - mockAPIer.On("PostLeasesAuth", reqParams, nil). - Return(&operations.PostLeasesAuthCreated{ - Payload: &operations.PostLeasesAuthCreatedBody{ - AccessKeyID: "access-key-id", - SecretAccessKey: "secret-access-key", - SessionToken: "session-token", - ConsoleURL: "console-url", - }, - }, nil) - - // Weber.OpenURL() should be called with the - // ConsoleURL returned by the API - mockWeber.On("OpenURL", "console-url") - - // Run the login command - service.Login(&service2.LeaseLoginOptions{ - OpenBrowser: true, - }) - - // Check that we called Weber.OpenURL() - mockWeber.AssertExpectations(t) -} diff --git a/tests/unit/terraform_test.go b/tests/unit/terraform_test.go index 7c3506e..8db0427 100644 --- a/tests/unit/terraform_test.go +++ b/tests/unit/terraform_test.go @@ -38,7 +38,7 @@ func TestTerraformBinUtil_ParseOptions(t *testing.T) { }, { name: "should parse normal tab-delimited string", - str: `-backend-config="address=demo.consul.io" -backend-config="path=example_app/terraform_state"`, + str: `-backend-config="address=demo.consul.io" -backend-config="path=example_app/terraform_state"`, want: []string{ "-backend-config=\"address=demo.consul.io\"", "-backend-config=\"path=example_app/terraform_state\"", @@ -56,7 +56,7 @@ func TestTerraformBinUtil_ParseOptions(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, err := util.ParseOptions(&tt.str) + got, err := util.ParseOptions(&tt.str) //nolint:gosec if (err != nil) != tt.wantErr { t.Errorf("ParseOptions() error = %v, wantErr %v", err, tt.wantErr) return diff --git a/tests/unit/tftemplate_test.go b/tests/unit/tftemplate_test.go index fd4b28a..3883ef7 100644 --- a/tests/unit/tftemplate_test.go +++ b/tests/unit/tftemplate_test.go @@ -3,7 +3,7 @@ package unit import ( "bytes" "fmt" - "io/ioutil" + "os" "testing" util "github.com/Optum/dce-cli/internal/util" @@ -42,7 +42,7 @@ func TestMainTFTemplate_Write(t *testing.T) { var actual bytes.Buffer - expected, err := ioutil.ReadFile("examples/maintf-basic.example") + expected, err := os.ReadFile("examples/maintf-basic.example") assert.Nil(t, err, "should have been able to read from file")