diff --git a/Makefile b/Makefile index 0f25222026..666f609e63 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,10 @@ format: .bin/goimports node_modules docs/node_modules gen: mocks sdk +.bin/ory: Makefile + bash <(curl https://raw.githubusercontent.com/ory/cli/master/install.sh) -b .bin v0.0.53 + touch -a -m .bin/ory + # Generates the SDKs .PHONY: sdk sdk: .bin/packr2 .bin/swagger .bin/ory diff --git a/internal/httpclient/client/api/api_client.go b/internal/httpclient/client/api/api_client.go index 68f716e7dc..ccf9be3ce8 100644 --- a/internal/httpclient/client/api/api_client.go +++ b/internal/httpclient/client/api/api_client.go @@ -25,24 +25,21 @@ 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, opts ...ClientOption) (*DecisionsOK, error) + Decisions(params *DecisionsParams) (*DecisionsOK, error) - GetRule(params *GetRuleParams, opts ...ClientOption) (*GetRuleOK, error) + GetRule(params *GetRuleParams) (*GetRuleOK, error) - GetVersion(params *GetVersionParams, opts ...ClientOption) (*GetVersionOK, error) + GetVersion(params *GetVersionParams) (*GetVersionOK, error) - GetWellKnownJSONWebKeys(params *GetWellKnownJSONWebKeysParams, opts ...ClientOption) (*GetWellKnownJSONWebKeysOK, error) + GetWellKnownJSONWebKeys(params *GetWellKnownJSONWebKeysParams) (*GetWellKnownJSONWebKeysOK, error) - IsInstanceAlive(params *IsInstanceAliveParams, opts ...ClientOption) (*IsInstanceAliveOK, error) + IsInstanceAlive(params *IsInstanceAliveParams) (*IsInstanceAliveOK, error) - IsInstanceReady(params *IsInstanceReadyParams, opts ...ClientOption) (*IsInstanceReadyOK, error) + IsInstanceReady(params *IsInstanceReadyParams) (*IsInstanceReadyOK, error) - ListRules(params *ListRulesParams, opts ...ClientOption) (*ListRulesOK, error) + ListRules(params *ListRulesParams) (*ListRulesOK, error) SetTransport(transport runtime.ClientTransport) } @@ -56,12 +53,13 @@ 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, opts ...ClientOption) (*DecisionsOK, error) { +func (a *Client) Decisions(params *DecisionsParams) (*DecisionsOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDecisionsParams() } - op := &runtime.ClientOperation{ + + result, err := a.transport.Submit(&runtime.ClientOperation{ ID: "decisions", Method: "GET", PathPattern: "/decisions", @@ -72,12 +70,7 @@ func (a *Client) Decisions(params *DecisionsParams, opts ...ClientOption) (*Deci 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 } @@ -96,12 +89,13 @@ func (a *Client) Decisions(params *DecisionsParams, opts ...ClientOption) (*Deci 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, opts ...ClientOption) (*GetRuleOK, error) { +func (a *Client) GetRule(params *GetRuleParams) (*GetRuleOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetRuleParams() } - op := &runtime.ClientOperation{ + + result, err := a.transport.Submit(&runtime.ClientOperation{ ID: "getRule", Method: "GET", PathPattern: "/rules/{id}", @@ -112,12 +106,7 @@ func (a *Client) GetRule(params *GetRuleParams, opts ...ClientOption) (*GetRuleO 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 } @@ -142,12 +131,13 @@ 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, opts ...ClientOption) (*GetVersionOK, error) { +func (a *Client) GetVersion(params *GetVersionParams) (*GetVersionOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetVersionParams() } - op := &runtime.ClientOperation{ + + result, err := a.transport.Submit(&runtime.ClientOperation{ ID: "getVersion", Method: "GET", PathPattern: "/version", @@ -158,12 +148,7 @@ func (a *Client) GetVersion(params *GetVersionParams, opts ...ClientOption) (*Ge 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 } @@ -182,12 +167,13 @@ func (a *Client) GetVersion(params *GetVersionParams, opts ...ClientOption) (*Ge This endpoint returns cryptographic keys that are required to, for example, verify signatures of ID Tokens. */ -func (a *Client) GetWellKnownJSONWebKeys(params *GetWellKnownJSONWebKeysParams, opts ...ClientOption) (*GetWellKnownJSONWebKeysOK, error) { +func (a *Client) GetWellKnownJSONWebKeys(params *GetWellKnownJSONWebKeysParams) (*GetWellKnownJSONWebKeysOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetWellKnownJSONWebKeysParams() } - op := &runtime.ClientOperation{ + + result, err := a.transport.Submit(&runtime.ClientOperation{ ID: "getWellKnownJSONWebKeys", Method: "GET", PathPattern: "/.well-known/jwks.json", @@ -198,12 +184,7 @@ 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 } @@ -229,12 +210,13 @@ 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, opts ...ClientOption) (*IsInstanceAliveOK, error) { +func (a *Client) IsInstanceAlive(params *IsInstanceAliveParams) (*IsInstanceAliveOK, error) { // TODO: Validate the params before sending if params == nil { params = NewIsInstanceAliveParams() } - op := &runtime.ClientOperation{ + + result, err := a.transport.Submit(&runtime.ClientOperation{ ID: "isInstanceAlive", Method: "GET", PathPattern: "/health/alive", @@ -245,12 +227,7 @@ func (a *Client) IsInstanceAlive(params *IsInstanceAliveParams, opts ...ClientOp 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 } @@ -276,12 +253,13 @@ 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, opts ...ClientOption) (*IsInstanceReadyOK, error) { +func (a *Client) IsInstanceReady(params *IsInstanceReadyParams) (*IsInstanceReadyOK, error) { // TODO: Validate the params before sending if params == nil { params = NewIsInstanceReadyParams() } - op := &runtime.ClientOperation{ + + result, err := a.transport.Submit(&runtime.ClientOperation{ ID: "isInstanceReady", Method: "GET", PathPattern: "/health/ready", @@ -292,12 +270,7 @@ func (a *Client) IsInstanceReady(params *IsInstanceReadyParams, opts ...ClientOp 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 } @@ -317,12 +290,13 @@ func (a *Client) IsInstanceReady(params *IsInstanceReadyParams, opts ...ClientOp 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, opts ...ClientOption) (*ListRulesOK, error) { +func (a *Client) ListRules(params *ListRulesParams) (*ListRulesOK, error) { // TODO: Validate the params before sending if params == nil { params = NewListRulesParams() } - op := &runtime.ClientOperation{ + + result, err := a.transport.Submit(&runtime.ClientOperation{ ID: "listRules", Method: "GET", PathPattern: "/rules", @@ -333,12 +307,7 @@ func (a *Client) ListRules(params *ListRulesParams, opts ...ClientOption) (*List 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 c14089e2ce..370e75873b 100644 --- a/internal/httpclient/client/api/decisions_parameters.go +++ b/internal/httpclient/client/api/decisions_parameters.go @@ -16,46 +16,47 @@ import ( "github.com/go-openapi/strfmt" ) -// 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. +// NewDecisionsParams creates a new DecisionsParams object +// with the default values initialized. func NewDecisionsParams() *DecisionsParams { + return &DecisionsParams{ + timeout: cr.DefaultTimeout, } } // NewDecisionsParamsWithTimeout creates a new DecisionsParams object -// with the ability to set a timeout on a request. +// with the default values initialized, and 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 ability to set a context for a request. +// with the default values initialized, and 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 ability to set a custom HTTPClient for a request. +// with the default values initialized, and 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 @@ -63,21 +64,6 @@ 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 e8c024aca4..394d8bde5d 100644 --- a/internal/httpclient/client/api/decisions_responses.go +++ b/internal/httpclient/client/api/decisions_responses.go @@ -6,7 +6,6 @@ package api // Editing this file might prove futile when you re-run the swagger generate command import ( - "context" "fmt" "io" @@ -53,6 +52,7 @@ 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 describes a response with status code 200, with default header values. +/*DecisionsOK handles this case with default header values. An empty response */ @@ -84,7 +84,7 @@ func NewDecisionsUnauthorized() *DecisionsUnauthorized { return &DecisionsUnauthorized{} } -/* DecisionsUnauthorized describes a response with status code 401, with default header values. +/*DecisionsUnauthorized handles this case with default header values. The standard error format */ @@ -95,6 +95,7 @@ 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 } @@ -116,7 +117,7 @@ func NewDecisionsForbidden() *DecisionsForbidden { return &DecisionsForbidden{} } -/* DecisionsForbidden describes a response with status code 403, with default header values. +/*DecisionsForbidden handles this case with default header values. The standard error format */ @@ -127,6 +128,7 @@ 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 } @@ -148,7 +150,7 @@ func NewDecisionsNotFound() *DecisionsNotFound { return &DecisionsNotFound{} } -/* DecisionsNotFound describes a response with status code 404, with default header values. +/*DecisionsNotFound handles this case with default header values. The standard error format */ @@ -159,6 +161,7 @@ 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 } @@ -180,7 +183,7 @@ func NewDecisionsInternalServerError() *DecisionsInternalServerError { return &DecisionsInternalServerError{} } -/* DecisionsInternalServerError describes a response with status code 500, with default header values. +/*DecisionsInternalServerError handles this case with default header values. The standard error format */ @@ -191,6 +194,7 @@ 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 } @@ -236,11 +240,6 @@ 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 { @@ -288,11 +287,6 @@ 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 { @@ -340,11 +334,6 @@ 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 { @@ -392,11 +381,6 @@ 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 f4d8bdd78a..570a2578f1 100644 --- a/internal/httpclient/client/api/get_rule_parameters.go +++ b/internal/httpclient/client/api/get_rule_parameters.go @@ -16,50 +16,51 @@ import ( "github.com/go-openapi/strfmt" ) -// 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. +// NewGetRuleParams creates a new GetRuleParams object +// with the default values initialized. func NewGetRuleParams() *GetRuleParams { + var () return &GetRuleParams{ + timeout: cr.DefaultTimeout, } } // NewGetRuleParamsWithTimeout creates a new GetRuleParams object -// with the ability to set a timeout on a request. +// with the default values initialized, and 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 ability to set a context for a request. +// with the default values initialized, and 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 ability to set a custom HTTPClient for a request. +// with the default values initialized, and 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 @@ -67,21 +68,6 @@ 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 d61ea29d23..d4688eea98 100644 --- a/internal/httpclient/client/api/get_rule_responses.go +++ b/internal/httpclient/client/api/get_rule_responses.go @@ -6,7 +6,6 @@ package api // Editing this file might prove futile when you re-run the swagger generate command import ( - "context" "fmt" "io" @@ -43,6 +42,7 @@ 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 describes a response with status code 200, with default header values. +/*GetRuleOK handles this case with default header values. A rule */ @@ -64,6 +64,7 @@ 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 } @@ -85,7 +86,7 @@ func NewGetRuleNotFound() *GetRuleNotFound { return &GetRuleNotFound{} } -/* GetRuleNotFound describes a response with status code 404, with default header values. +/*GetRuleNotFound handles this case with default header values. The standard error format */ @@ -96,6 +97,7 @@ 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 } @@ -117,7 +119,7 @@ func NewGetRuleInternalServerError() *GetRuleInternalServerError { return &GetRuleInternalServerError{} } -/* GetRuleInternalServerError describes a response with status code 500, with default header values. +/*GetRuleInternalServerError handles this case with default header values. The standard error format */ @@ -128,6 +130,7 @@ 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 } @@ -173,11 +176,6 @@ 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 { @@ -225,11 +223,6 @@ 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 8391443439..de8a4c4cc7 100644 --- a/internal/httpclient/client/api/get_version_parameters.go +++ b/internal/httpclient/client/api/get_version_parameters.go @@ -16,46 +16,47 @@ import ( "github.com/go-openapi/strfmt" ) -// 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. +// NewGetVersionParams creates a new GetVersionParams object +// with the default values initialized. func NewGetVersionParams() *GetVersionParams { + return &GetVersionParams{ + timeout: cr.DefaultTimeout, } } // NewGetVersionParamsWithTimeout creates a new GetVersionParams object -// with the ability to set a timeout on a request. +// with the default values initialized, and 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 ability to set a context for a request. +// with the default values initialized, and 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 ability to set a custom HTTPClient for a request. +// with the default values initialized, and 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 @@ -63,21 +64,6 @@ 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 2b0fb03515..c801efe552 100644 --- a/internal/httpclient/client/api/get_version_responses.go +++ b/internal/httpclient/client/api/get_version_responses.go @@ -29,6 +29,7 @@ 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()) } @@ -39,7 +40,7 @@ func NewGetVersionOK() *GetVersionOK { return &GetVersionOK{} } -/* GetVersionOK describes a response with status code 200, with default header values. +/*GetVersionOK handles this case with default header values. version */ @@ -50,6 +51,7 @@ 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 774e913633..3068e145e4 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,46 +16,47 @@ import ( "github.com/go-openapi/strfmt" ) -// 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. +// NewGetWellKnownJSONWebKeysParams creates a new GetWellKnownJSONWebKeysParams object +// with the default values initialized. func NewGetWellKnownJSONWebKeysParams() *GetWellKnownJSONWebKeysParams { + return &GetWellKnownJSONWebKeysParams{ + timeout: cr.DefaultTimeout, } } // NewGetWellKnownJSONWebKeysParamsWithTimeout creates a new GetWellKnownJSONWebKeysParams object -// with the ability to set a timeout on a request. +// with the default values initialized, and 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 ability to set a context for a request. +// with the default values initialized, and 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 ability to set a custom HTTPClient for a request. +// with the default values initialized, and 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 @@ -63,21 +64,6 @@ 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 3b7011292b..c619219c81 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,7 +6,6 @@ package api // Editing this file might prove futile when you re-run the swagger generate command import ( - "context" "fmt" "io" @@ -37,6 +36,7 @@ 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 describes a response with status code 200, with default header values. +/*GetWellKnownJSONWebKeysOK handles this case with default header values. jsonWebKeySet */ @@ -58,6 +58,7 @@ 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 } @@ -79,7 +80,7 @@ func NewGetWellKnownJSONWebKeysInternalServerError() *GetWellKnownJSONWebKeysInt return &GetWellKnownJSONWebKeysInternalServerError{} } -/* GetWellKnownJSONWebKeysInternalServerError describes a response with status code 500, with default header values. +/*GetWellKnownJSONWebKeysInternalServerError handles this case with default header values. The standard error format */ @@ -90,6 +91,7 @@ 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 } @@ -135,11 +137,6 @@ 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 78943c489f..ac0dac22c9 100644 --- a/internal/httpclient/client/api/is_instance_alive_parameters.go +++ b/internal/httpclient/client/api/is_instance_alive_parameters.go @@ -16,46 +16,47 @@ import ( "github.com/go-openapi/strfmt" ) -// 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. +// NewIsInstanceAliveParams creates a new IsInstanceAliveParams object +// with the default values initialized. func NewIsInstanceAliveParams() *IsInstanceAliveParams { + return &IsInstanceAliveParams{ + timeout: cr.DefaultTimeout, } } // NewIsInstanceAliveParamsWithTimeout creates a new IsInstanceAliveParams object -// with the ability to set a timeout on a request. +// with the default values initialized, and 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 ability to set a context for a request. +// with the default values initialized, and 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 ability to set a custom HTTPClient for a request. +// with the default values initialized, and 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 @@ -63,21 +64,6 @@ 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 1e07d33460..ab1b215e28 100644 --- a/internal/httpclient/client/api/is_instance_alive_responses.go +++ b/internal/httpclient/client/api/is_instance_alive_responses.go @@ -6,7 +6,6 @@ package api // Editing this file might prove futile when you re-run the swagger generate command import ( - "context" "fmt" "io" @@ -37,6 +36,7 @@ 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 describes a response with status code 200, with default header values. +/*IsInstanceAliveOK handles this case with default header values. healthStatus */ @@ -58,6 +58,7 @@ 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 } @@ -79,7 +80,7 @@ func NewIsInstanceAliveInternalServerError() *IsInstanceAliveInternalServerError return &IsInstanceAliveInternalServerError{} } -/* IsInstanceAliveInternalServerError describes a response with status code 500, with default header values. +/*IsInstanceAliveInternalServerError handles this case with default header values. The standard error format */ @@ -90,6 +91,7 @@ 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 } @@ -135,11 +137,6 @@ 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 bf3a8a9b34..dd92da186e 100644 --- a/internal/httpclient/client/api/is_instance_ready_parameters.go +++ b/internal/httpclient/client/api/is_instance_ready_parameters.go @@ -16,46 +16,47 @@ import ( "github.com/go-openapi/strfmt" ) -// 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. +// NewIsInstanceReadyParams creates a new IsInstanceReadyParams object +// with the default values initialized. func NewIsInstanceReadyParams() *IsInstanceReadyParams { + return &IsInstanceReadyParams{ + timeout: cr.DefaultTimeout, } } // NewIsInstanceReadyParamsWithTimeout creates a new IsInstanceReadyParams object -// with the ability to set a timeout on a request. +// with the default values initialized, and 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 ability to set a context for a request. +// with the default values initialized, and 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 ability to set a custom HTTPClient for a request. +// with the default values initialized, and 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 @@ -63,21 +64,6 @@ 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 1852b5f6c3..35de29f97b 100644 --- a/internal/httpclient/client/api/is_instance_ready_responses.go +++ b/internal/httpclient/client/api/is_instance_ready_responses.go @@ -35,6 +35,7 @@ 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()) } @@ -45,7 +46,7 @@ func NewIsInstanceReadyOK() *IsInstanceReadyOK { return &IsInstanceReadyOK{} } -/* IsInstanceReadyOK describes a response with status code 200, with default header values. +/*IsInstanceReadyOK handles this case with default header values. healthStatus */ @@ -56,6 +57,7 @@ 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 } @@ -77,7 +79,7 @@ func NewIsInstanceReadyServiceUnavailable() *IsInstanceReadyServiceUnavailable { return &IsInstanceReadyServiceUnavailable{} } -/* IsInstanceReadyServiceUnavailable describes a response with status code 503, with default header values. +/*IsInstanceReadyServiceUnavailable handles this case with default header values. healthNotReadyStatus */ @@ -88,6 +90,7 @@ 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 c9dfe18d4e..cd4f2744b4 100644 --- a/internal/httpclient/client/api/list_rules_parameters.go +++ b/internal/httpclient/client/api/list_rules_parameters.go @@ -17,62 +17,58 @@ import ( "github.com/go-openapi/swag" ) -// 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. +// NewListRulesParams creates a new ListRulesParams object +// with the default values initialized. func NewListRulesParams() *ListRulesParams { + var () return &ListRulesParams{ + timeout: cr.DefaultTimeout, } } // NewListRulesParamsWithTimeout creates a new ListRulesParams object -// with the ability to set a timeout on a request. +// with the default values initialized, and 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 ability to set a context for a request. +// with the default values initialized, and 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 ability to set a custom HTTPClient for a request. +// with the default values initialized, and 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 @@ -81,21 +77,6 @@ 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) @@ -163,34 +144,32 @@ 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 1e9be25b17..9c96cd5796 100644 --- a/internal/httpclient/client/api/list_rules_responses.go +++ b/internal/httpclient/client/api/list_rules_responses.go @@ -6,7 +6,6 @@ package api // Editing this file might prove futile when you re-run the swagger generate command import ( - "context" "fmt" "io" @@ -37,6 +36,7 @@ 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 describes a response with status code 200, with default header values. +/*ListRulesOK handles this case with default header values. A list of rules */ @@ -58,6 +58,7 @@ 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 } @@ -77,7 +78,7 @@ func NewListRulesInternalServerError() *ListRulesInternalServerError { return &ListRulesInternalServerError{} } -/* ListRulesInternalServerError describes a response with status code 500, with default header values. +/*ListRulesInternalServerError handles this case with default header values. The standard error format */ @@ -88,6 +89,7 @@ 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 } @@ -133,11 +135,6 @@ 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/client/health/health_client.go b/internal/httpclient/client/health/health_client.go deleted file mode 100644 index 1c8c657860..0000000000 --- a/internal/httpclient/client/health/health_client.go +++ /dev/null @@ -1,137 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package health - -// 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" - "github.com/go-openapi/strfmt" -) - -// New creates a new health API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { - return &Client{transport: transport, formats: formats} -} - -/* -Client for health API -*/ -type Client struct { - transport runtime.ClientTransport - 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 { - IsInstanceAlive(params *IsInstanceAliveParams, opts ...ClientOption) (*IsInstanceAliveOK, error) - - IsInstanceReady(params *IsInstanceReadyParams, opts ...ClientOption) (*IsInstanceReadyOK, error) - - SetTransport(transport runtime.ClientTransport) -} - -/* - IsInstanceAlive checks alive status - - This endpoint returns a 200 status code when the HTTP server is up running. -This status does currently not include checks whether the database connection is working. - -If the service supports TLS Edge Termination, this endpoint does not require the -`X-Forwarded-Proto` header to be set. - -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, opts ...ClientOption) (*IsInstanceAliveOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewIsInstanceAliveParams() - } - op := &runtime.ClientOperation{ - ID: "isInstanceAlive", - Method: "GET", - PathPattern: "/health/alive", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, - Params: params, - 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 - } - success, ok := result.(*IsInstanceAliveOK) - 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 isInstanceAlive: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* - IsInstanceReady checks readiness status - - This endpoint returns a 200 status code when the HTTP server is up running and the environment dependencies (e.g. -the database) are responsive as well. - -If the service supports TLS Edge Termination, this endpoint does not require the -`X-Forwarded-Proto` header to be set. - -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, opts ...ClientOption) (*IsInstanceReadyOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewIsInstanceReadyParams() - } - op := &runtime.ClientOperation{ - ID: "isInstanceReady", - Method: "GET", - PathPattern: "/health/ready", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, - Params: params, - 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 - } - success, ok := result.(*IsInstanceReadyOK) - 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 isInstanceReady: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/internal/httpclient/client/health/is_instance_alive_parameters.go b/internal/httpclient/client/health/is_instance_alive_parameters.go deleted file mode 100644 index 0cf82c0d9c..0000000000 --- a/internal/httpclient/client/health/is_instance_alive_parameters.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package health - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// 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 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 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 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. -*/ -type IsInstanceAliveParams struct { - timeout time.Duration - Context context.Context - 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) - return o -} - -// SetTimeout adds the timeout to the is instance alive params -func (o *IsInstanceAliveParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the is instance alive params -func (o *IsInstanceAliveParams) WithContext(ctx context.Context) *IsInstanceAliveParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the is instance alive params -func (o *IsInstanceAliveParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the is instance alive params -func (o *IsInstanceAliveParams) WithHTTPClient(client *http.Client) *IsInstanceAliveParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the is instance alive params -func (o *IsInstanceAliveParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *IsInstanceAliveParams) 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/internal/httpclient/client/health/is_instance_alive_responses.go b/internal/httpclient/client/health/is_instance_alive_responses.go deleted file mode 100644 index a7fc7ed49a..0000000000 --- a/internal/httpclient/client/health/is_instance_alive_responses.go +++ /dev/null @@ -1,159 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package health - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/ory/oathkeeper/internal/httpclient/models" -) - -// IsInstanceAliveReader is a Reader for the IsInstanceAlive structure. -type IsInstanceAliveReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *IsInstanceAliveReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewIsInstanceAliveOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 500: - result := NewIsInstanceAliveInternalServerError() - if err := result.readResponse(response, consumer, o.formats); err != nil { - 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()) - } -} - -// NewIsInstanceAliveOK creates a IsInstanceAliveOK with default headers values -func NewIsInstanceAliveOK() *IsInstanceAliveOK { - return &IsInstanceAliveOK{} -} - -/* IsInstanceAliveOK describes a response with status code 200, with default header values. - -healthStatus -*/ -type IsInstanceAliveOK struct { - Payload *models.HealthStatus -} - -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 -} - -func (o *IsInstanceAliveOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HealthStatus) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewIsInstanceAliveInternalServerError creates a IsInstanceAliveInternalServerError with default headers values -func NewIsInstanceAliveInternalServerError() *IsInstanceAliveInternalServerError { - return &IsInstanceAliveInternalServerError{} -} - -/* IsInstanceAliveInternalServerError describes a response with status code 500, with default header values. - -The standard error format -*/ -type IsInstanceAliveInternalServerError struct { - Payload *IsInstanceAliveInternalServerErrorBody -} - -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 -} - -func (o *IsInstanceAliveInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(IsInstanceAliveInternalServerErrorBody) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -/*IsInstanceAliveInternalServerErrorBody is instance alive internal server error body -swagger:model IsInstanceAliveInternalServerErrorBody -*/ -type IsInstanceAliveInternalServerErrorBody struct { - - // code - Code int64 `json:"code,omitempty"` - - // details - Details []interface{} `json:"details"` - - // message - Message string `json:"message,omitempty"` - - // reason - Reason string `json:"reason,omitempty"` - - // request - Request string `json:"request,omitempty"` - - // status - Status string `json:"status,omitempty"` -} - -// Validate validates this is instance alive internal server error body -func (o *IsInstanceAliveInternalServerErrorBody) Validate(formats strfmt.Registry) error { - 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 { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *IsInstanceAliveInternalServerErrorBody) UnmarshalBinary(b []byte) error { - var res IsInstanceAliveInternalServerErrorBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/internal/httpclient/client/health/is_instance_ready_parameters.go b/internal/httpclient/client/health/is_instance_ready_parameters.go deleted file mode 100644 index 1a72fdb583..0000000000 --- a/internal/httpclient/client/health/is_instance_ready_parameters.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package health - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// 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 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 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 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. -*/ -type IsInstanceReadyParams struct { - timeout time.Duration - Context context.Context - 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) - return o -} - -// SetTimeout adds the timeout to the is instance ready params -func (o *IsInstanceReadyParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the is instance ready params -func (o *IsInstanceReadyParams) WithContext(ctx context.Context) *IsInstanceReadyParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the is instance ready params -func (o *IsInstanceReadyParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the is instance ready params -func (o *IsInstanceReadyParams) WithHTTPClient(client *http.Client) *IsInstanceReadyParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the is instance ready params -func (o *IsInstanceReadyParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *IsInstanceReadyParams) 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/internal/httpclient/client/health/is_instance_ready_responses.go b/internal/httpclient/client/health/is_instance_ready_responses.go deleted file mode 100644 index 30615fd10f..0000000000 --- a/internal/httpclient/client/health/is_instance_ready_responses.go +++ /dev/null @@ -1,105 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package health - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/ory/oathkeeper/internal/httpclient/models" -) - -// IsInstanceReadyReader is a Reader for the IsInstanceReady structure. -type IsInstanceReadyReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *IsInstanceReadyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewIsInstanceReadyOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 503: - result := NewIsInstanceReadyServiceUnavailable() - if err := result.readResponse(response, consumer, o.formats); err != nil { - 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()) - } -} - -// NewIsInstanceReadyOK creates a IsInstanceReadyOK with default headers values -func NewIsInstanceReadyOK() *IsInstanceReadyOK { - return &IsInstanceReadyOK{} -} - -/* IsInstanceReadyOK describes a response with status code 200, with default header values. - -healthStatus -*/ -type IsInstanceReadyOK struct { - Payload *models.HealthStatus -} - -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 -} - -func (o *IsInstanceReadyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HealthStatus) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewIsInstanceReadyServiceUnavailable creates a IsInstanceReadyServiceUnavailable with default headers values -func NewIsInstanceReadyServiceUnavailable() *IsInstanceReadyServiceUnavailable { - return &IsInstanceReadyServiceUnavailable{} -} - -/* IsInstanceReadyServiceUnavailable describes a response with status code 503, with default header values. - -healthNotReadyStatus -*/ -type IsInstanceReadyServiceUnavailable struct { - Payload *models.HealthNotReadyStatus -} - -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 -} - -func (o *IsInstanceReadyServiceUnavailable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HealthNotReadyStatus) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/internal/httpclient/client/version/get_version_parameters.go b/internal/httpclient/client/version/get_version_parameters.go deleted file mode 100644 index 06e87f7941..0000000000 --- a/internal/httpclient/client/version/get_version_parameters.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package version - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// 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 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 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 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. -*/ -type GetVersionParams struct { - timeout time.Duration - Context context.Context - 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) - return o -} - -// SetTimeout adds the timeout to the get version params -func (o *GetVersionParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get version params -func (o *GetVersionParams) WithContext(ctx context.Context) *GetVersionParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get version params -func (o *GetVersionParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get version params -func (o *GetVersionParams) WithHTTPClient(client *http.Client) *GetVersionParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get version params -func (o *GetVersionParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *GetVersionParams) 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/internal/httpclient/client/version/get_version_responses.go b/internal/httpclient/client/version/get_version_responses.go deleted file mode 100644 index fa24a10d06..0000000000 --- a/internal/httpclient/client/version/get_version_responses.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package version - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/ory/oathkeeper/internal/httpclient/models" -) - -// GetVersionReader is a Reader for the GetVersion structure. -type GetVersionReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetVersionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetVersionOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) - } -} - -// NewGetVersionOK creates a GetVersionOK with default headers values -func NewGetVersionOK() *GetVersionOK { - return &GetVersionOK{} -} - -/* GetVersionOK describes a response with status code 200, with default header values. - -version -*/ -type GetVersionOK struct { - Payload *models.Version -} - -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 -} - -func (o *GetVersionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.Version) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/internal/httpclient/client/version/version_client.go b/internal/httpclient/client/version/version_client.go deleted file mode 100644 index 8a0180018c..0000000000 --- a/internal/httpclient/client/version/version_client.go +++ /dev/null @@ -1,87 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package version - -// 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" - "github.com/go-openapi/strfmt" -) - -// New creates a new version API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { - return &Client{transport: transport, formats: formats} -} - -/* -Client for version API -*/ -type Client struct { - transport runtime.ClientTransport - 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 { - GetVersion(params *GetVersionParams, opts ...ClientOption) (*GetVersionOK, error) - - SetTransport(transport runtime.ClientTransport) -} - -/* - GetVersion gets service version - - This endpoint returns the service version typically notated using semantic versioning. - -If the service supports TLS Edge Termination, this endpoint does not require the -`X-Forwarded-Proto` header to be set. - -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, opts ...ClientOption) (*GetVersionOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetVersionParams() - } - op := &runtime.ClientOperation{ - ID: "getVersion", - Method: "GET", - PathPattern: "/version", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, - Params: params, - 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 - } - success, ok := result.(*GetVersionOK) - 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 getVersion: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/internal/httpclient/models/health_not_ready_status.go b/internal/httpclient/models/health_not_ready_status.go index bab6d3873e..64626783ed 100644 --- a/internal/httpclient/models/health_not_ready_status.go +++ b/internal/httpclient/models/health_not_ready_status.go @@ -6,8 +6,6 @@ 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" ) @@ -26,11 +24,6 @@ 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 5525dbc20e..60ba32416b 100644 --- a/internal/httpclient/models/health_status.go +++ b/internal/httpclient/models/health_status.go @@ -6,8 +6,6 @@ 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" ) @@ -26,11 +24,6 @@ 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 047927ebef..6425597b3c 100644 --- a/internal/httpclient/models/json_web_key.go +++ b/internal/httpclient/models/json_web_key.go @@ -6,8 +6,6 @@ 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" ) @@ -99,11 +97,6 @@ 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 2e746cb13c..66eb83fabd 100644 --- a/internal/httpclient/models/json_web_key_set.go +++ b/internal/httpclient/models/json_web_key_set.go @@ -6,7 +6,6 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - "context" "strconv" "github.com/go-openapi/errors" @@ -42,6 +41,7 @@ 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,38 +65,6 @@ 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 964a898ea1..275ded0f54 100644 --- a/internal/httpclient/models/rule.go +++ b/internal/httpclient/models/rule.go @@ -6,7 +6,6 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - "context" "strconv" "github.com/go-openapi/errors" @@ -81,6 +80,7 @@ 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,6 +105,7 @@ 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 } @@ -122,6 +123,7 @@ 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 } @@ -139,6 +141,7 @@ 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 } @@ -163,6 +166,7 @@ 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 } @@ -179,114 +183,6 @@ 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 0e055f01d0..e3bb224748 100644 --- a/internal/httpclient/models/rule_handler.go +++ b/internal/httpclient/models/rule_handler.go @@ -6,8 +6,6 @@ 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,11 +29,6 @@ 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 2ec45086ed..5c5b6eef2e 100644 --- a/internal/httpclient/models/rule_match.go +++ b/internal/httpclient/models/rule_match.go @@ -6,8 +6,6 @@ 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" ) @@ -39,11 +37,6 @@ 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 6b167a97a6..e1bdc5d23f 100644 --- a/internal/httpclient/models/upstream.go +++ b/internal/httpclient/models/upstream.go @@ -6,8 +6,6 @@ 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" ) @@ -33,11 +31,6 @@ 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 2a92642e53..8e687bcb20 100644 --- a/internal/httpclient/models/version.go +++ b/internal/httpclient/models/version.go @@ -6,8 +6,6 @@ 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" ) @@ -26,11 +24,6 @@ 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 {