diff --git a/internal/httpclient/client/api/api_client.go b/internal/httpclient/client/api/api_client.go index ccf9be3ce8..68f716e7dc 100644 --- a/internal/httpclient/client/api/api_client.go +++ b/internal/httpclient/client/api/api_client.go @@ -25,21 +25,24 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + // ClientService is the interface for Client methods type ClientService interface { - Decisions(params *DecisionsParams) (*DecisionsOK, error) + Decisions(params *DecisionsParams, opts ...ClientOption) (*DecisionsOK, error) - GetRule(params *GetRuleParams) (*GetRuleOK, error) + GetRule(params *GetRuleParams, opts ...ClientOption) (*GetRuleOK, error) - GetVersion(params *GetVersionParams) (*GetVersionOK, error) + GetVersion(params *GetVersionParams, opts ...ClientOption) (*GetVersionOK, error) - GetWellKnownJSONWebKeys(params *GetWellKnownJSONWebKeysParams) (*GetWellKnownJSONWebKeysOK, error) + GetWellKnownJSONWebKeys(params *GetWellKnownJSONWebKeysParams, opts ...ClientOption) (*GetWellKnownJSONWebKeysOK, error) - IsInstanceAlive(params *IsInstanceAliveParams) (*IsInstanceAliveOK, error) + IsInstanceAlive(params *IsInstanceAliveParams, opts ...ClientOption) (*IsInstanceAliveOK, error) - IsInstanceReady(params *IsInstanceReadyParams) (*IsInstanceReadyOK, error) + IsInstanceReady(params *IsInstanceReadyParams, opts ...ClientOption) (*IsInstanceReadyOK, error) - ListRules(params *ListRulesParams) (*ListRulesOK, error) + ListRules(params *ListRulesParams, opts ...ClientOption) (*ListRulesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -53,13 +56,12 @@ This endpoint mirrors the proxy capability of ORY Oathkeeper's proxy functionali request to the upstream server, returns 200 (request should be allowed), 401 (unauthorized), or 403 (forbidden) status codes. This endpoint can be used to integrate with other API Proxies like Ambassador, Kong, Envoy, and many more. */ -func (a *Client) Decisions(params *DecisionsParams) (*DecisionsOK, error) { +func (a *Client) Decisions(params *DecisionsParams, opts ...ClientOption) (*DecisionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDecisionsParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "decisions", Method: "GET", PathPattern: "/decisions", @@ -70,7 +72,12 @@ func (a *Client) Decisions(params *DecisionsParams) (*DecisionsOK, error) { Reader: &DecisionsReader{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 } @@ -89,13 +96,12 @@ func (a *Client) Decisions(params *DecisionsParams) (*DecisionsOK, error) { Use this method to retrieve a rule from the storage. If it does not exist you will receive a 404 error. */ -func (a *Client) GetRule(params *GetRuleParams) (*GetRuleOK, error) { +func (a *Client) GetRule(params *GetRuleParams, opts ...ClientOption) (*GetRuleOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetRuleParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getRule", Method: "GET", PathPattern: "/rules/{id}", @@ -106,7 +112,12 @@ func (a *Client) GetRule(params *GetRuleParams) (*GetRuleOK, error) { Reader: &GetRuleReader{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 } @@ -131,13 +142,12 @@ If the service supports TLS Edge Termination, this endpoint does not require the Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance. */ -func (a *Client) GetVersion(params *GetVersionParams) (*GetVersionOK, error) { +func (a *Client) GetVersion(params *GetVersionParams, opts ...ClientOption) (*GetVersionOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetVersionParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getVersion", Method: "GET", PathPattern: "/version", @@ -148,7 +158,12 @@ func (a *Client) GetVersion(params *GetVersionParams) (*GetVersionOK, error) { Reader: &GetVersionReader{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 } @@ -167,13 +182,12 @@ func (a *Client) GetVersion(params *GetVersionParams) (*GetVersionOK, error) { This endpoint returns cryptographic keys that are required to, for example, verify signatures of ID Tokens. */ -func (a *Client) GetWellKnownJSONWebKeys(params *GetWellKnownJSONWebKeysParams) (*GetWellKnownJSONWebKeysOK, error) { +func (a *Client) GetWellKnownJSONWebKeys(params *GetWellKnownJSONWebKeysParams, opts ...ClientOption) (*GetWellKnownJSONWebKeysOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetWellKnownJSONWebKeysParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "getWellKnownJSONWebKeys", Method: "GET", PathPattern: "/.well-known/jwks.json", @@ -184,7 +198,12 @@ func (a *Client) GetWellKnownJSONWebKeys(params *GetWellKnownJSONWebKeysParams) Reader: &GetWellKnownJSONWebKeysReader{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 } @@ -210,13 +229,12 @@ If the service supports TLS Edge Termination, this endpoint does not require the Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance. */ -func (a *Client) IsInstanceAlive(params *IsInstanceAliveParams) (*IsInstanceAliveOK, error) { +func (a *Client) IsInstanceAlive(params *IsInstanceAliveParams, opts ...ClientOption) (*IsInstanceAliveOK, error) { // TODO: Validate the params before sending if params == nil { params = NewIsInstanceAliveParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "isInstanceAlive", Method: "GET", PathPattern: "/health/alive", @@ -227,7 +245,12 @@ func (a *Client) IsInstanceAlive(params *IsInstanceAliveParams) (*IsInstanceAliv Reader: &IsInstanceAliveReader{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 } @@ -253,13 +276,12 @@ If the service supports TLS Edge Termination, this endpoint does not require the Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance. */ -func (a *Client) IsInstanceReady(params *IsInstanceReadyParams) (*IsInstanceReadyOK, error) { +func (a *Client) IsInstanceReady(params *IsInstanceReadyParams, opts ...ClientOption) (*IsInstanceReadyOK, error) { // TODO: Validate the params before sending if params == nil { params = NewIsInstanceReadyParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "isInstanceReady", Method: "GET", PathPattern: "/health/ready", @@ -270,7 +292,12 @@ func (a *Client) IsInstanceReady(params *IsInstanceReadyParams) (*IsInstanceRead Reader: &IsInstanceReadyReader{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 } @@ -290,13 +317,12 @@ func (a *Client) IsInstanceReady(params *IsInstanceReadyParams) (*IsInstanceRead This method returns an array of all rules that are stored in the backend. This is useful if you want to get a full view of what rules you have currently in place. */ -func (a *Client) ListRules(params *ListRulesParams) (*ListRulesOK, error) { +func (a *Client) ListRules(params *ListRulesParams, opts ...ClientOption) (*ListRulesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewListRulesParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "listRules", Method: "GET", PathPattern: "/rules", @@ -307,7 +333,12 @@ func (a *Client) ListRules(params *ListRulesParams) (*ListRulesOK, error) { Reader: &ListRulesReader{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/internal/httpclient/client/api/decisions_parameters.go b/internal/httpclient/client/api/decisions_parameters.go index 370e75873b..c14089e2ce 100644 --- a/internal/httpclient/client/api/decisions_parameters.go +++ b/internal/httpclient/client/api/decisions_parameters.go @@ -16,47 +16,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewDecisionsParams creates a new DecisionsParams object -// with the default values initialized. +// NewDecisionsParams creates a new DecisionsParams 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 NewDecisionsParams() *DecisionsParams { - return &DecisionsParams{ - timeout: cr.DefaultTimeout, } } // NewDecisionsParamsWithTimeout creates a new DecisionsParams 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 NewDecisionsParamsWithTimeout(timeout time.Duration) *DecisionsParams { - return &DecisionsParams{ - timeout: timeout, } } // NewDecisionsParamsWithContext creates a new DecisionsParams 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 NewDecisionsParamsWithContext(ctx context.Context) *DecisionsParams { - return &DecisionsParams{ - Context: ctx, } } // NewDecisionsParamsWithHTTPClient creates a new DecisionsParams 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 NewDecisionsParamsWithHTTPClient(client *http.Client) *DecisionsParams { - return &DecisionsParams{ HTTPClient: client, } } -/*DecisionsParams contains all the parameters to send to the API endpoint -for the decisions operation typically these are written to a http.Request +/* DecisionsParams contains all the parameters to send to the API endpoint + for the decisions operation. + + Typically these are written to a http.Request. */ type DecisionsParams struct { timeout time.Duration @@ -64,6 +63,21 @@ type DecisionsParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the decisions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DecisionsParams) WithDefaults() *DecisionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the decisions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DecisionsParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the decisions params func (o *DecisionsParams) WithTimeout(timeout time.Duration) *DecisionsParams { o.SetTimeout(timeout) diff --git a/internal/httpclient/client/api/decisions_responses.go b/internal/httpclient/client/api/decisions_responses.go index 394d8bde5d..e8c024aca4 100644 --- a/internal/httpclient/client/api/decisions_responses.go +++ b/internal/httpclient/client/api/decisions_responses.go @@ -6,6 +6,7 @@ package api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "fmt" "io" @@ -52,7 +53,6 @@ func (o *DecisionsReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } @@ -63,7 +63,7 @@ func NewDecisionsOK() *DecisionsOK { return &DecisionsOK{} } -/*DecisionsOK handles this case with default header values. +/* DecisionsOK describes a response with status code 200, with default header values. An empty response */ @@ -84,7 +84,7 @@ func NewDecisionsUnauthorized() *DecisionsUnauthorized { return &DecisionsUnauthorized{} } -/*DecisionsUnauthorized handles this case with default header values. +/* DecisionsUnauthorized describes a response with status code 401, with default header values. The standard error format */ @@ -95,7 +95,6 @@ type DecisionsUnauthorized struct { func (o *DecisionsUnauthorized) Error() string { return fmt.Sprintf("[GET /decisions][%d] decisionsUnauthorized %+v", 401, o.Payload) } - func (o *DecisionsUnauthorized) GetPayload() *DecisionsUnauthorizedBody { return o.Payload } @@ -117,7 +116,7 @@ func NewDecisionsForbidden() *DecisionsForbidden { return &DecisionsForbidden{} } -/*DecisionsForbidden handles this case with default header values. +/* DecisionsForbidden describes a response with status code 403, with default header values. The standard error format */ @@ -128,7 +127,6 @@ type DecisionsForbidden struct { func (o *DecisionsForbidden) Error() string { return fmt.Sprintf("[GET /decisions][%d] decisionsForbidden %+v", 403, o.Payload) } - func (o *DecisionsForbidden) GetPayload() *DecisionsForbiddenBody { return o.Payload } @@ -150,7 +148,7 @@ func NewDecisionsNotFound() *DecisionsNotFound { return &DecisionsNotFound{} } -/*DecisionsNotFound handles this case with default header values. +/* DecisionsNotFound describes a response with status code 404, with default header values. The standard error format */ @@ -161,7 +159,6 @@ type DecisionsNotFound struct { func (o *DecisionsNotFound) Error() string { return fmt.Sprintf("[GET /decisions][%d] decisionsNotFound %+v", 404, o.Payload) } - func (o *DecisionsNotFound) GetPayload() *DecisionsNotFoundBody { return o.Payload } @@ -183,7 +180,7 @@ func NewDecisionsInternalServerError() *DecisionsInternalServerError { return &DecisionsInternalServerError{} } -/*DecisionsInternalServerError handles this case with default header values. +/* DecisionsInternalServerError describes a response with status code 500, with default header values. The standard error format */ @@ -194,7 +191,6 @@ type DecisionsInternalServerError struct { func (o *DecisionsInternalServerError) Error() string { return fmt.Sprintf("[GET /decisions][%d] decisionsInternalServerError %+v", 500, o.Payload) } - func (o *DecisionsInternalServerError) GetPayload() *DecisionsInternalServerErrorBody { return o.Payload } @@ -240,6 +236,11 @@ func (o *DecisionsForbiddenBody) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this decisions forbidden body based on context it is used +func (o *DecisionsForbiddenBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *DecisionsForbiddenBody) MarshalBinary() ([]byte, error) { if o == nil { @@ -287,6 +288,11 @@ func (o *DecisionsInternalServerErrorBody) Validate(formats strfmt.Registry) err return nil } +// ContextValidate validates this decisions internal server error body based on context it is used +func (o *DecisionsInternalServerErrorBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *DecisionsInternalServerErrorBody) MarshalBinary() ([]byte, error) { if o == nil { @@ -334,6 +340,11 @@ func (o *DecisionsNotFoundBody) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this decisions not found body based on context it is used +func (o *DecisionsNotFoundBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *DecisionsNotFoundBody) MarshalBinary() ([]byte, error) { if o == nil { @@ -381,6 +392,11 @@ func (o *DecisionsUnauthorizedBody) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this decisions unauthorized body based on context it is used +func (o *DecisionsUnauthorizedBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *DecisionsUnauthorizedBody) MarshalBinary() ([]byte, error) { if o == nil { diff --git a/internal/httpclient/client/api/get_rule_parameters.go b/internal/httpclient/client/api/get_rule_parameters.go index 570a2578f1..f4d8bdd78a 100644 --- a/internal/httpclient/client/api/get_rule_parameters.go +++ b/internal/httpclient/client/api/get_rule_parameters.go @@ -16,51 +16,50 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetRuleParams creates a new GetRuleParams object -// with the default values initialized. +// NewGetRuleParams creates a new GetRuleParams 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 NewGetRuleParams() *GetRuleParams { - var () return &GetRuleParams{ - timeout: cr.DefaultTimeout, } } // NewGetRuleParamsWithTimeout creates a new GetRuleParams 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 NewGetRuleParamsWithTimeout(timeout time.Duration) *GetRuleParams { - var () return &GetRuleParams{ - timeout: timeout, } } // NewGetRuleParamsWithContext creates a new GetRuleParams 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 NewGetRuleParamsWithContext(ctx context.Context) *GetRuleParams { - var () return &GetRuleParams{ - Context: ctx, } } // NewGetRuleParamsWithHTTPClient creates a new GetRuleParams 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 NewGetRuleParamsWithHTTPClient(client *http.Client) *GetRuleParams { - var () return &GetRuleParams{ HTTPClient: client, } } -/*GetRuleParams contains all the parameters to send to the API endpoint -for the get rule operation typically these are written to a http.Request +/* GetRuleParams contains all the parameters to send to the API endpoint + for the get rule operation. + + Typically these are written to a http.Request. */ type GetRuleParams struct { - /*ID*/ + // ID. ID string timeout time.Duration @@ -68,6 +67,21 @@ type GetRuleParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get rule params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetRuleParams) WithDefaults() *GetRuleParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get rule params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetRuleParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get rule params func (o *GetRuleParams) WithTimeout(timeout time.Duration) *GetRuleParams { o.SetTimeout(timeout) diff --git a/internal/httpclient/client/api/get_rule_responses.go b/internal/httpclient/client/api/get_rule_responses.go index d4688eea98..d61ea29d23 100644 --- a/internal/httpclient/client/api/get_rule_responses.go +++ b/internal/httpclient/client/api/get_rule_responses.go @@ -6,6 +6,7 @@ package api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "fmt" "io" @@ -42,7 +43,6 @@ func (o *GetRuleReader) ReadResponse(response runtime.ClientResponse, consumer r return nil, err } return nil, result - default: return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } @@ -53,7 +53,7 @@ func NewGetRuleOK() *GetRuleOK { return &GetRuleOK{} } -/*GetRuleOK handles this case with default header values. +/* GetRuleOK describes a response with status code 200, with default header values. A rule */ @@ -64,7 +64,6 @@ type GetRuleOK struct { func (o *GetRuleOK) Error() string { return fmt.Sprintf("[GET /rules/{id}][%d] getRuleOK %+v", 200, o.Payload) } - func (o *GetRuleOK) GetPayload() *models.Rule { return o.Payload } @@ -86,7 +85,7 @@ func NewGetRuleNotFound() *GetRuleNotFound { return &GetRuleNotFound{} } -/*GetRuleNotFound handles this case with default header values. +/* GetRuleNotFound describes a response with status code 404, with default header values. The standard error format */ @@ -97,7 +96,6 @@ type GetRuleNotFound struct { func (o *GetRuleNotFound) Error() string { return fmt.Sprintf("[GET /rules/{id}][%d] getRuleNotFound %+v", 404, o.Payload) } - func (o *GetRuleNotFound) GetPayload() *GetRuleNotFoundBody { return o.Payload } @@ -119,7 +117,7 @@ func NewGetRuleInternalServerError() *GetRuleInternalServerError { return &GetRuleInternalServerError{} } -/*GetRuleInternalServerError handles this case with default header values. +/* GetRuleInternalServerError describes a response with status code 500, with default header values. The standard error format */ @@ -130,7 +128,6 @@ type GetRuleInternalServerError struct { func (o *GetRuleInternalServerError) Error() string { return fmt.Sprintf("[GET /rules/{id}][%d] getRuleInternalServerError %+v", 500, o.Payload) } - func (o *GetRuleInternalServerError) GetPayload() *GetRuleInternalServerErrorBody { return o.Payload } @@ -176,6 +173,11 @@ func (o *GetRuleInternalServerErrorBody) Validate(formats strfmt.Registry) error return nil } +// ContextValidate validates this get rule internal server error body based on context it is used +func (o *GetRuleInternalServerErrorBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *GetRuleInternalServerErrorBody) MarshalBinary() ([]byte, error) { if o == nil { @@ -223,6 +225,11 @@ func (o *GetRuleNotFoundBody) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this get rule not found body based on context it is used +func (o *GetRuleNotFoundBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *GetRuleNotFoundBody) MarshalBinary() ([]byte, error) { if o == nil { diff --git a/internal/httpclient/client/api/get_version_parameters.go b/internal/httpclient/client/api/get_version_parameters.go index de8a4c4cc7..8391443439 100644 --- a/internal/httpclient/client/api/get_version_parameters.go +++ b/internal/httpclient/client/api/get_version_parameters.go @@ -16,47 +16,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetVersionParams creates a new GetVersionParams object -// with the default values initialized. +// NewGetVersionParams creates a new GetVersionParams 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 NewGetVersionParams() *GetVersionParams { - return &GetVersionParams{ - timeout: cr.DefaultTimeout, } } // NewGetVersionParamsWithTimeout creates a new GetVersionParams 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 NewGetVersionParamsWithTimeout(timeout time.Duration) *GetVersionParams { - return &GetVersionParams{ - timeout: timeout, } } // NewGetVersionParamsWithContext creates a new GetVersionParams 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 NewGetVersionParamsWithContext(ctx context.Context) *GetVersionParams { - return &GetVersionParams{ - Context: ctx, } } // NewGetVersionParamsWithHTTPClient creates a new GetVersionParams 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 NewGetVersionParamsWithHTTPClient(client *http.Client) *GetVersionParams { - return &GetVersionParams{ HTTPClient: client, } } -/*GetVersionParams contains all the parameters to send to the API endpoint -for the get version operation typically these are written to a http.Request +/* GetVersionParams contains all the parameters to send to the API endpoint + for the get version operation. + + Typically these are written to a http.Request. */ type GetVersionParams struct { timeout time.Duration @@ -64,6 +63,21 @@ type GetVersionParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get version params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetVersionParams) WithDefaults() *GetVersionParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get version params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetVersionParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get version params func (o *GetVersionParams) WithTimeout(timeout time.Duration) *GetVersionParams { o.SetTimeout(timeout) diff --git a/internal/httpclient/client/api/get_version_responses.go b/internal/httpclient/client/api/get_version_responses.go index c801efe552..2b0fb03515 100644 --- a/internal/httpclient/client/api/get_version_responses.go +++ b/internal/httpclient/client/api/get_version_responses.go @@ -29,7 +29,6 @@ func (o *GetVersionReader) ReadResponse(response runtime.ClientResponse, consume return nil, err } return result, nil - default: return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } @@ -40,7 +39,7 @@ func NewGetVersionOK() *GetVersionOK { return &GetVersionOK{} } -/*GetVersionOK handles this case with default header values. +/* GetVersionOK describes a response with status code 200, with default header values. version */ @@ -51,7 +50,6 @@ type GetVersionOK struct { func (o *GetVersionOK) Error() string { return fmt.Sprintf("[GET /version][%d] getVersionOK %+v", 200, o.Payload) } - func (o *GetVersionOK) GetPayload() *models.Version { return o.Payload } diff --git a/internal/httpclient/client/api/get_well_known_json_web_keys_parameters.go b/internal/httpclient/client/api/get_well_known_json_web_keys_parameters.go index 3068e145e4..774e913633 100644 --- a/internal/httpclient/client/api/get_well_known_json_web_keys_parameters.go +++ b/internal/httpclient/client/api/get_well_known_json_web_keys_parameters.go @@ -16,47 +16,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetWellKnownJSONWebKeysParams creates a new GetWellKnownJSONWebKeysParams object -// with the default values initialized. +// NewGetWellKnownJSONWebKeysParams creates a new GetWellKnownJSONWebKeysParams 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 NewGetWellKnownJSONWebKeysParams() *GetWellKnownJSONWebKeysParams { - return &GetWellKnownJSONWebKeysParams{ - timeout: cr.DefaultTimeout, } } // NewGetWellKnownJSONWebKeysParamsWithTimeout creates a new GetWellKnownJSONWebKeysParams 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 NewGetWellKnownJSONWebKeysParamsWithTimeout(timeout time.Duration) *GetWellKnownJSONWebKeysParams { - return &GetWellKnownJSONWebKeysParams{ - timeout: timeout, } } // NewGetWellKnownJSONWebKeysParamsWithContext creates a new GetWellKnownJSONWebKeysParams 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 NewGetWellKnownJSONWebKeysParamsWithContext(ctx context.Context) *GetWellKnownJSONWebKeysParams { - return &GetWellKnownJSONWebKeysParams{ - Context: ctx, } } // NewGetWellKnownJSONWebKeysParamsWithHTTPClient creates a new GetWellKnownJSONWebKeysParams 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 NewGetWellKnownJSONWebKeysParamsWithHTTPClient(client *http.Client) *GetWellKnownJSONWebKeysParams { - return &GetWellKnownJSONWebKeysParams{ HTTPClient: client, } } -/*GetWellKnownJSONWebKeysParams contains all the parameters to send to the API endpoint -for the get well known JSON web keys operation typically these are written to a http.Request +/* GetWellKnownJSONWebKeysParams contains all the parameters to send to the API endpoint + for the get well known JSON web keys operation. + + Typically these are written to a http.Request. */ type GetWellKnownJSONWebKeysParams struct { timeout time.Duration @@ -64,6 +63,21 @@ type GetWellKnownJSONWebKeysParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get well known JSON web keys params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetWellKnownJSONWebKeysParams) WithDefaults() *GetWellKnownJSONWebKeysParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get well known JSON web keys params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetWellKnownJSONWebKeysParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get well known JSON web keys params func (o *GetWellKnownJSONWebKeysParams) WithTimeout(timeout time.Duration) *GetWellKnownJSONWebKeysParams { o.SetTimeout(timeout) diff --git a/internal/httpclient/client/api/get_well_known_json_web_keys_responses.go b/internal/httpclient/client/api/get_well_known_json_web_keys_responses.go index c619219c81..3b7011292b 100644 --- a/internal/httpclient/client/api/get_well_known_json_web_keys_responses.go +++ b/internal/httpclient/client/api/get_well_known_json_web_keys_responses.go @@ -6,6 +6,7 @@ package api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "fmt" "io" @@ -36,7 +37,6 @@ func (o *GetWellKnownJSONWebKeysReader) ReadResponse(response runtime.ClientResp return nil, err } return nil, result - default: return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } @@ -47,7 +47,7 @@ func NewGetWellKnownJSONWebKeysOK() *GetWellKnownJSONWebKeysOK { return &GetWellKnownJSONWebKeysOK{} } -/*GetWellKnownJSONWebKeysOK handles this case with default header values. +/* GetWellKnownJSONWebKeysOK describes a response with status code 200, with default header values. jsonWebKeySet */ @@ -58,7 +58,6 @@ type GetWellKnownJSONWebKeysOK struct { func (o *GetWellKnownJSONWebKeysOK) Error() string { return fmt.Sprintf("[GET /.well-known/jwks.json][%d] getWellKnownJsonWebKeysOK %+v", 200, o.Payload) } - func (o *GetWellKnownJSONWebKeysOK) GetPayload() *models.JSONWebKeySet { return o.Payload } @@ -80,7 +79,7 @@ func NewGetWellKnownJSONWebKeysInternalServerError() *GetWellKnownJSONWebKeysInt return &GetWellKnownJSONWebKeysInternalServerError{} } -/*GetWellKnownJSONWebKeysInternalServerError handles this case with default header values. +/* GetWellKnownJSONWebKeysInternalServerError describes a response with status code 500, with default header values. The standard error format */ @@ -91,7 +90,6 @@ type GetWellKnownJSONWebKeysInternalServerError struct { func (o *GetWellKnownJSONWebKeysInternalServerError) Error() string { return fmt.Sprintf("[GET /.well-known/jwks.json][%d] getWellKnownJsonWebKeysInternalServerError %+v", 500, o.Payload) } - func (o *GetWellKnownJSONWebKeysInternalServerError) GetPayload() *GetWellKnownJSONWebKeysInternalServerErrorBody { return o.Payload } @@ -137,6 +135,11 @@ func (o *GetWellKnownJSONWebKeysInternalServerErrorBody) Validate(formats strfmt return nil } +// ContextValidate validates this get well known JSON web keys internal server error body based on context it is used +func (o *GetWellKnownJSONWebKeysInternalServerErrorBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *GetWellKnownJSONWebKeysInternalServerErrorBody) MarshalBinary() ([]byte, error) { if o == nil { diff --git a/internal/httpclient/client/api/is_instance_alive_parameters.go b/internal/httpclient/client/api/is_instance_alive_parameters.go index ac0dac22c9..78943c489f 100644 --- a/internal/httpclient/client/api/is_instance_alive_parameters.go +++ b/internal/httpclient/client/api/is_instance_alive_parameters.go @@ -16,47 +16,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewIsInstanceAliveParams creates a new IsInstanceAliveParams object -// with the default values initialized. +// NewIsInstanceAliveParams creates a new IsInstanceAliveParams 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 NewIsInstanceAliveParams() *IsInstanceAliveParams { - return &IsInstanceAliveParams{ - timeout: cr.DefaultTimeout, } } // NewIsInstanceAliveParamsWithTimeout creates a new IsInstanceAliveParams 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 NewIsInstanceAliveParamsWithTimeout(timeout time.Duration) *IsInstanceAliveParams { - return &IsInstanceAliveParams{ - timeout: timeout, } } // NewIsInstanceAliveParamsWithContext creates a new IsInstanceAliveParams 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 NewIsInstanceAliveParamsWithContext(ctx context.Context) *IsInstanceAliveParams { - return &IsInstanceAliveParams{ - Context: ctx, } } // NewIsInstanceAliveParamsWithHTTPClient creates a new IsInstanceAliveParams 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 NewIsInstanceAliveParamsWithHTTPClient(client *http.Client) *IsInstanceAliveParams { - return &IsInstanceAliveParams{ HTTPClient: client, } } -/*IsInstanceAliveParams contains all the parameters to send to the API endpoint -for the is instance alive operation typically these are written to a http.Request +/* IsInstanceAliveParams contains all the parameters to send to the API endpoint + for the is instance alive operation. + + Typically these are written to a http.Request. */ type IsInstanceAliveParams struct { timeout time.Duration @@ -64,6 +63,21 @@ type IsInstanceAliveParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the is instance alive params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *IsInstanceAliveParams) WithDefaults() *IsInstanceAliveParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the is instance alive params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *IsInstanceAliveParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the is instance alive params func (o *IsInstanceAliveParams) WithTimeout(timeout time.Duration) *IsInstanceAliveParams { o.SetTimeout(timeout) diff --git a/internal/httpclient/client/api/is_instance_alive_responses.go b/internal/httpclient/client/api/is_instance_alive_responses.go index ab1b215e28..1e07d33460 100644 --- a/internal/httpclient/client/api/is_instance_alive_responses.go +++ b/internal/httpclient/client/api/is_instance_alive_responses.go @@ -6,6 +6,7 @@ package api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "fmt" "io" @@ -36,7 +37,6 @@ func (o *IsInstanceAliveReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } @@ -47,7 +47,7 @@ func NewIsInstanceAliveOK() *IsInstanceAliveOK { return &IsInstanceAliveOK{} } -/*IsInstanceAliveOK handles this case with default header values. +/* IsInstanceAliveOK describes a response with status code 200, with default header values. healthStatus */ @@ -58,7 +58,6 @@ type IsInstanceAliveOK struct { func (o *IsInstanceAliveOK) Error() string { return fmt.Sprintf("[GET /health/alive][%d] isInstanceAliveOK %+v", 200, o.Payload) } - func (o *IsInstanceAliveOK) GetPayload() *models.HealthStatus { return o.Payload } @@ -80,7 +79,7 @@ func NewIsInstanceAliveInternalServerError() *IsInstanceAliveInternalServerError return &IsInstanceAliveInternalServerError{} } -/*IsInstanceAliveInternalServerError handles this case with default header values. +/* IsInstanceAliveInternalServerError describes a response with status code 500, with default header values. The standard error format */ @@ -91,7 +90,6 @@ type IsInstanceAliveInternalServerError struct { func (o *IsInstanceAliveInternalServerError) Error() string { return fmt.Sprintf("[GET /health/alive][%d] isInstanceAliveInternalServerError %+v", 500, o.Payload) } - func (o *IsInstanceAliveInternalServerError) GetPayload() *IsInstanceAliveInternalServerErrorBody { return o.Payload } @@ -137,6 +135,11 @@ func (o *IsInstanceAliveInternalServerErrorBody) Validate(formats strfmt.Registr return nil } +// ContextValidate validates this is instance alive internal server error body based on context it is used +func (o *IsInstanceAliveInternalServerErrorBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *IsInstanceAliveInternalServerErrorBody) MarshalBinary() ([]byte, error) { if o == nil { diff --git a/internal/httpclient/client/api/is_instance_ready_parameters.go b/internal/httpclient/client/api/is_instance_ready_parameters.go index dd92da186e..bf3a8a9b34 100644 --- a/internal/httpclient/client/api/is_instance_ready_parameters.go +++ b/internal/httpclient/client/api/is_instance_ready_parameters.go @@ -16,47 +16,46 @@ import ( "github.com/go-openapi/strfmt" ) -// NewIsInstanceReadyParams creates a new IsInstanceReadyParams object -// with the default values initialized. +// NewIsInstanceReadyParams creates a new IsInstanceReadyParams 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 NewIsInstanceReadyParams() *IsInstanceReadyParams { - return &IsInstanceReadyParams{ - timeout: cr.DefaultTimeout, } } // NewIsInstanceReadyParamsWithTimeout creates a new IsInstanceReadyParams 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 NewIsInstanceReadyParamsWithTimeout(timeout time.Duration) *IsInstanceReadyParams { - return &IsInstanceReadyParams{ - timeout: timeout, } } // NewIsInstanceReadyParamsWithContext creates a new IsInstanceReadyParams 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 NewIsInstanceReadyParamsWithContext(ctx context.Context) *IsInstanceReadyParams { - return &IsInstanceReadyParams{ - Context: ctx, } } // NewIsInstanceReadyParamsWithHTTPClient creates a new IsInstanceReadyParams 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 NewIsInstanceReadyParamsWithHTTPClient(client *http.Client) *IsInstanceReadyParams { - return &IsInstanceReadyParams{ HTTPClient: client, } } -/*IsInstanceReadyParams contains all the parameters to send to the API endpoint -for the is instance ready operation typically these are written to a http.Request +/* IsInstanceReadyParams contains all the parameters to send to the API endpoint + for the is instance ready operation. + + Typically these are written to a http.Request. */ type IsInstanceReadyParams struct { timeout time.Duration @@ -64,6 +63,21 @@ type IsInstanceReadyParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the is instance ready params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *IsInstanceReadyParams) WithDefaults() *IsInstanceReadyParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the is instance ready params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *IsInstanceReadyParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the is instance ready params func (o *IsInstanceReadyParams) WithTimeout(timeout time.Duration) *IsInstanceReadyParams { o.SetTimeout(timeout) diff --git a/internal/httpclient/client/api/is_instance_ready_responses.go b/internal/httpclient/client/api/is_instance_ready_responses.go index 35de29f97b..1852b5f6c3 100644 --- a/internal/httpclient/client/api/is_instance_ready_responses.go +++ b/internal/httpclient/client/api/is_instance_ready_responses.go @@ -35,7 +35,6 @@ func (o *IsInstanceReadyReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - default: return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } @@ -46,7 +45,7 @@ func NewIsInstanceReadyOK() *IsInstanceReadyOK { return &IsInstanceReadyOK{} } -/*IsInstanceReadyOK handles this case with default header values. +/* IsInstanceReadyOK describes a response with status code 200, with default header values. healthStatus */ @@ -57,7 +56,6 @@ type IsInstanceReadyOK struct { func (o *IsInstanceReadyOK) Error() string { return fmt.Sprintf("[GET /health/ready][%d] isInstanceReadyOK %+v", 200, o.Payload) } - func (o *IsInstanceReadyOK) GetPayload() *models.HealthStatus { return o.Payload } @@ -79,7 +77,7 @@ func NewIsInstanceReadyServiceUnavailable() *IsInstanceReadyServiceUnavailable { return &IsInstanceReadyServiceUnavailable{} } -/*IsInstanceReadyServiceUnavailable handles this case with default header values. +/* IsInstanceReadyServiceUnavailable describes a response with status code 503, with default header values. healthNotReadyStatus */ @@ -90,7 +88,6 @@ type IsInstanceReadyServiceUnavailable struct { func (o *IsInstanceReadyServiceUnavailable) Error() string { return fmt.Sprintf("[GET /health/ready][%d] isInstanceReadyServiceUnavailable %+v", 503, o.Payload) } - func (o *IsInstanceReadyServiceUnavailable) GetPayload() *models.HealthNotReadyStatus { return o.Payload } diff --git a/internal/httpclient/client/api/list_rules_parameters.go b/internal/httpclient/client/api/list_rules_parameters.go index cd4f2744b4..c9dfe18d4e 100644 --- a/internal/httpclient/client/api/list_rules_parameters.go +++ b/internal/httpclient/client/api/list_rules_parameters.go @@ -17,58 +17,62 @@ import ( "github.com/go-openapi/swag" ) -// NewListRulesParams creates a new ListRulesParams object -// with the default values initialized. +// NewListRulesParams creates a new ListRulesParams 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 NewListRulesParams() *ListRulesParams { - var () return &ListRulesParams{ - timeout: cr.DefaultTimeout, } } // NewListRulesParamsWithTimeout creates a new ListRulesParams 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 NewListRulesParamsWithTimeout(timeout time.Duration) *ListRulesParams { - var () return &ListRulesParams{ - timeout: timeout, } } // NewListRulesParamsWithContext creates a new ListRulesParams 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 NewListRulesParamsWithContext(ctx context.Context) *ListRulesParams { - var () return &ListRulesParams{ - Context: ctx, } } // NewListRulesParamsWithHTTPClient creates a new ListRulesParams 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 NewListRulesParamsWithHTTPClient(client *http.Client) *ListRulesParams { - var () return &ListRulesParams{ HTTPClient: client, } } -/*ListRulesParams contains all the parameters to send to the API endpoint -for the list rules operation typically these are written to a http.Request +/* ListRulesParams contains all the parameters to send to the API endpoint + for the list rules operation. + + Typically these are written to a http.Request. */ type ListRulesParams struct { - /*Limit - The maximum amount of rules returned. + /* Limit. + + The maximum amount of rules returned. + Format: int64 */ Limit *int64 - /*Offset - The offset from where to start looking. + /* Offset. + + The offset from where to start looking. + + Format: int64 */ Offset *int64 @@ -77,6 +81,21 @@ type ListRulesParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the list rules params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListRulesParams) WithDefaults() *ListRulesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list rules params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListRulesParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the list rules params func (o *ListRulesParams) WithTimeout(timeout time.Duration) *ListRulesParams { o.SetTimeout(timeout) @@ -144,32 +163,34 @@ func (o *ListRulesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Reg // 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.Offset != nil { // query param offset var qrOffset int64 + if o.Offset != nil { qrOffset = *o.Offset } qOffset := swag.FormatInt64(qrOffset) if qOffset != "" { + if err := r.SetQueryParam("offset", qOffset); err != nil { return err } } - } if len(res) > 0 { diff --git a/internal/httpclient/client/api/list_rules_responses.go b/internal/httpclient/client/api/list_rules_responses.go index 9c96cd5796..1e9be25b17 100644 --- a/internal/httpclient/client/api/list_rules_responses.go +++ b/internal/httpclient/client/api/list_rules_responses.go @@ -6,6 +6,7 @@ package api // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "fmt" "io" @@ -36,7 +37,6 @@ func (o *ListRulesReader) ReadResponse(response runtime.ClientResponse, consumer return nil, err } return nil, result - default: return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } @@ -47,7 +47,7 @@ func NewListRulesOK() *ListRulesOK { return &ListRulesOK{} } -/*ListRulesOK handles this case with default header values. +/* ListRulesOK describes a response with status code 200, with default header values. A list of rules */ @@ -58,7 +58,6 @@ type ListRulesOK struct { func (o *ListRulesOK) Error() string { return fmt.Sprintf("[GET /rules][%d] listRulesOK %+v", 200, o.Payload) } - func (o *ListRulesOK) GetPayload() []*models.Rule { return o.Payload } @@ -78,7 +77,7 @@ func NewListRulesInternalServerError() *ListRulesInternalServerError { return &ListRulesInternalServerError{} } -/*ListRulesInternalServerError handles this case with default header values. +/* ListRulesInternalServerError describes a response with status code 500, with default header values. The standard error format */ @@ -89,7 +88,6 @@ type ListRulesInternalServerError struct { func (o *ListRulesInternalServerError) Error() string { return fmt.Sprintf("[GET /rules][%d] listRulesInternalServerError %+v", 500, o.Payload) } - func (o *ListRulesInternalServerError) GetPayload() *ListRulesInternalServerErrorBody { return o.Payload } @@ -135,6 +133,11 @@ func (o *ListRulesInternalServerErrorBody) Validate(formats strfmt.Registry) err return nil } +// ContextValidate validates this list rules internal server error body based on context it is used +func (o *ListRulesInternalServerErrorBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *ListRulesInternalServerErrorBody) MarshalBinary() ([]byte, error) { if o == nil { diff --git a/internal/httpclient/models/health_not_ready_status.go b/internal/httpclient/models/health_not_ready_status.go index 64626783ed..bab6d3873e 100644 --- a/internal/httpclient/models/health_not_ready_status.go +++ b/internal/httpclient/models/health_not_ready_status.go @@ -6,6 +6,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -24,6 +26,11 @@ func (m *HealthNotReadyStatus) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this health not ready status based on context it is used +func (m *HealthNotReadyStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *HealthNotReadyStatus) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/internal/httpclient/models/health_status.go b/internal/httpclient/models/health_status.go index 60ba32416b..5525dbc20e 100644 --- a/internal/httpclient/models/health_status.go +++ b/internal/httpclient/models/health_status.go @@ -6,6 +6,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -24,6 +26,11 @@ func (m *HealthStatus) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this health status based on context it is used +func (m *HealthStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *HealthStatus) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/internal/httpclient/models/json_web_key.go b/internal/httpclient/models/json_web_key.go index 6425597b3c..047927ebef 100644 --- a/internal/httpclient/models/json_web_key.go +++ b/internal/httpclient/models/json_web_key.go @@ -6,6 +6,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -97,6 +99,11 @@ func (m *JSONWebKey) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this json web key based on context it is used +func (m *JSONWebKey) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *JSONWebKey) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/internal/httpclient/models/json_web_key_set.go b/internal/httpclient/models/json_web_key_set.go index 66eb83fabd..2e746cb13c 100644 --- a/internal/httpclient/models/json_web_key_set.go +++ b/internal/httpclient/models/json_web_key_set.go @@ -6,6 +6,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -41,7 +42,6 @@ func (m *JSONWebKeySet) Validate(formats strfmt.Registry) error { } func (m *JSONWebKeySet) validateKeys(formats strfmt.Registry) error { - if swag.IsZero(m.Keys) { // not required return nil } @@ -65,6 +65,38 @@ func (m *JSONWebKeySet) validateKeys(formats strfmt.Registry) error { return nil } +// ContextValidate validate this json web key set based on the context it is used +func (m *JSONWebKeySet) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateKeys(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *JSONWebKeySet) contextValidateKeys(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Keys); i++ { + + if m.Keys[i] != nil { + if err := m.Keys[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keys" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *JSONWebKeySet) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/internal/httpclient/models/rule.go b/internal/httpclient/models/rule.go index 275ded0f54..964a898ea1 100644 --- a/internal/httpclient/models/rule.go +++ b/internal/httpclient/models/rule.go @@ -6,6 +6,7 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" "github.com/go-openapi/errors" @@ -80,7 +81,6 @@ func (m *Rule) Validate(formats strfmt.Registry) error { } func (m *Rule) validateAuthenticators(formats strfmt.Registry) error { - if swag.IsZero(m.Authenticators) { // not required return nil } @@ -105,7 +105,6 @@ func (m *Rule) validateAuthenticators(formats strfmt.Registry) error { } func (m *Rule) validateAuthorizer(formats strfmt.Registry) error { - if swag.IsZero(m.Authorizer) { // not required return nil } @@ -123,7 +122,6 @@ func (m *Rule) validateAuthorizer(formats strfmt.Registry) error { } func (m *Rule) validateMatch(formats strfmt.Registry) error { - if swag.IsZero(m.Match) { // not required return nil } @@ -141,7 +139,6 @@ func (m *Rule) validateMatch(formats strfmt.Registry) error { } func (m *Rule) validateMutators(formats strfmt.Registry) error { - if swag.IsZero(m.Mutators) { // not required return nil } @@ -166,7 +163,6 @@ func (m *Rule) validateMutators(formats strfmt.Registry) error { } func (m *Rule) validateUpstream(formats strfmt.Registry) error { - if swag.IsZero(m.Upstream) { // not required return nil } @@ -183,6 +179,114 @@ func (m *Rule) validateUpstream(formats strfmt.Registry) error { return nil } +// ContextValidate validate this rule based on the context it is used +func (m *Rule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAuthenticators(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateAuthorizer(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMatch(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMutators(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUpstream(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Rule) contextValidateAuthenticators(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Authenticators); i++ { + + if m.Authenticators[i] != nil { + if err := m.Authenticators[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authenticators" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Rule) contextValidateAuthorizer(ctx context.Context, formats strfmt.Registry) error { + + if m.Authorizer != nil { + if err := m.Authorizer.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authorizer") + } + return err + } + } + + return nil +} + +func (m *Rule) contextValidateMatch(ctx context.Context, formats strfmt.Registry) error { + + if m.Match != nil { + if err := m.Match.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("match") + } + return err + } + } + + return nil +} + +func (m *Rule) contextValidateMutators(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Mutators); i++ { + + if m.Mutators[i] != nil { + if err := m.Mutators[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("mutators" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Rule) contextValidateUpstream(ctx context.Context, formats strfmt.Registry) error { + + if m.Upstream != nil { + if err := m.Upstream.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("upstream") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Rule) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/internal/httpclient/models/rule_handler.go b/internal/httpclient/models/rule_handler.go index e3bb224748..0e055f01d0 100644 --- a/internal/httpclient/models/rule_handler.go +++ b/internal/httpclient/models/rule_handler.go @@ -6,6 +6,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -29,6 +31,11 @@ func (m *RuleHandler) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this rule handler based on context it is used +func (m *RuleHandler) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *RuleHandler) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/internal/httpclient/models/rule_match.go b/internal/httpclient/models/rule_match.go index 5c5b6eef2e..2ec45086ed 100644 --- a/internal/httpclient/models/rule_match.go +++ b/internal/httpclient/models/rule_match.go @@ -6,6 +6,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -37,6 +39,11 @@ func (m *RuleMatch) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this rule match based on context it is used +func (m *RuleMatch) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *RuleMatch) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/internal/httpclient/models/upstream.go b/internal/httpclient/models/upstream.go index e1bdc5d23f..6b167a97a6 100644 --- a/internal/httpclient/models/upstream.go +++ b/internal/httpclient/models/upstream.go @@ -6,6 +6,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -31,6 +33,11 @@ func (m *Upstream) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this upstream based on context it is used +func (m *Upstream) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Upstream) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/internal/httpclient/models/version.go b/internal/httpclient/models/version.go index 8e687bcb20..2a92642e53 100644 --- a/internal/httpclient/models/version.go +++ b/internal/httpclient/models/version.go @@ -6,6 +6,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -24,6 +26,11 @@ func (m *Version) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this version based on context it is used +func (m *Version) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Version) MarshalBinary() ([]byte, error) { if m == nil {