diff --git a/api/client/cluster/cluster_client.go b/api/client/cluster/cluster_client.go index c4d24a4..c11c3b9 100644 --- a/api/client/cluster/cluster_client.go +++ b/api/client/cluster/cluster_client.go @@ -480,7 +480,7 @@ func (a *Client) ListConstraints(params *ListConstraintsParams, authInfo runtime } /* -ReconcileCluster triggers cluster reconcilation +ReconcileCluster triggers cluster reconciliation */ func (a *Client) ReconcileCluster(params *ReconcileClusterParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ReconcileClusterOK, error) { // TODO: Validate the params before sending diff --git a/api/client/database/get_postgres_secrets_responses.go b/api/client/database/get_postgres_secrets_responses.go index 69d3012..ea968e7 100644 --- a/api/client/database/get_postgres_secrets_responses.go +++ b/api/client/database/get_postgres_secrets_responses.go @@ -53,7 +53,7 @@ GetPostgresSecretsOK describes a response with status code 200, with default hea OK */ type GetPostgresSecretsOK struct { - Payload *models.V1PostgresSecretsRespone + Payload *models.V1PostgresSecretsResponse } // IsSuccess returns true when this get postgres secrets o k response has a 2xx status code @@ -94,13 +94,13 @@ func (o *GetPostgresSecretsOK) String() string { return fmt.Sprintf("[GET /v1/database/postgres/{id}/secrets][%d] getPostgresSecretsOK %+v", 200, o.Payload) } -func (o *GetPostgresSecretsOK) GetPayload() *models.V1PostgresSecretsRespone { +func (o *GetPostgresSecretsOK) GetPayload() *models.V1PostgresSecretsResponse { return o.Payload } func (o *GetPostgresSecretsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(models.V1PostgresSecretsRespone) + o.Payload = new(models.V1PostgresSecretsResponse) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { diff --git a/api/client/volume/list_policies_parameters.go b/api/client/volume/list_policies_parameters.go new file mode 100644 index 0000000..4106f63 --- /dev/null +++ b/api/client/volume/list_policies_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package volume + +// 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" +) + +// NewListPoliciesParams creates a new ListPoliciesParams 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 NewListPoliciesParams() *ListPoliciesParams { + return &ListPoliciesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListPoliciesParamsWithTimeout creates a new ListPoliciesParams object +// with the ability to set a timeout on a request. +func NewListPoliciesParamsWithTimeout(timeout time.Duration) *ListPoliciesParams { + return &ListPoliciesParams{ + timeout: timeout, + } +} + +// NewListPoliciesParamsWithContext creates a new ListPoliciesParams object +// with the ability to set a context for a request. +func NewListPoliciesParamsWithContext(ctx context.Context) *ListPoliciesParams { + return &ListPoliciesParams{ + Context: ctx, + } +} + +// NewListPoliciesParamsWithHTTPClient creates a new ListPoliciesParams object +// with the ability to set a custom HTTPClient for a request. +func NewListPoliciesParamsWithHTTPClient(client *http.Client) *ListPoliciesParams { + return &ListPoliciesParams{ + HTTPClient: client, + } +} + +/* +ListPoliciesParams contains all the parameters to send to the API endpoint + + for the list policies operation. + + Typically these are written to a http.Request. +*/ +type ListPoliciesParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list policies params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListPoliciesParams) WithDefaults() *ListPoliciesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list policies params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListPoliciesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list policies params +func (o *ListPoliciesParams) WithTimeout(timeout time.Duration) *ListPoliciesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list policies params +func (o *ListPoliciesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list policies params +func (o *ListPoliciesParams) WithContext(ctx context.Context) *ListPoliciesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list policies params +func (o *ListPoliciesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list policies params +func (o *ListPoliciesParams) WithHTTPClient(client *http.Client) *ListPoliciesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list policies params +func (o *ListPoliciesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ListPoliciesParams) 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/api/client/volume/list_policies_responses.go b/api/client/volume/list_policies_responses.go new file mode 100644 index 0000000..3a26fba --- /dev/null +++ b/api/client/volume/list_policies_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package volume + +// 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/fi-ts/cloud-go/api/models" + "github.com/metal-stack/metal-lib/httperrors" +) + +// ListPoliciesReader is a Reader for the ListPolicies structure. +type ListPoliciesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListPoliciesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListPoliciesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListPoliciesDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewListPoliciesOK creates a ListPoliciesOK with default headers values +func NewListPoliciesOK() *ListPoliciesOK { + return &ListPoliciesOK{} +} + +/* +ListPoliciesOK describes a response with status code 200, with default header values. + +OK +*/ +type ListPoliciesOK struct { + Payload []*models.V1QoSPolicyResponse +} + +// IsSuccess returns true when this list policies o k response has a 2xx status code +func (o *ListPoliciesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list policies o k response has a 3xx status code +func (o *ListPoliciesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list policies o k response has a 4xx status code +func (o *ListPoliciesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list policies o k response has a 5xx status code +func (o *ListPoliciesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list policies o k response a status code equal to that given +func (o *ListPoliciesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list policies o k response +func (o *ListPoliciesOK) Code() int { + return 200 +} + +func (o *ListPoliciesOK) Error() string { + return fmt.Sprintf("[GET /v1/volume/qos][%d] listPoliciesOK %+v", 200, o.Payload) +} + +func (o *ListPoliciesOK) String() string { + return fmt.Sprintf("[GET /v1/volume/qos][%d] listPoliciesOK %+v", 200, o.Payload) +} + +func (o *ListPoliciesOK) GetPayload() []*models.V1QoSPolicyResponse { + return o.Payload +} + +func (o *ListPoliciesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListPoliciesDefault creates a ListPoliciesDefault with default headers values +func NewListPoliciesDefault(code int) *ListPoliciesDefault { + return &ListPoliciesDefault{ + _statusCode: code, + } +} + +/* +ListPoliciesDefault describes a response with status code -1, with default header values. + +Error +*/ +type ListPoliciesDefault struct { + _statusCode int + + Payload *httperrors.HTTPErrorResponse +} + +// IsSuccess returns true when this list policies default response has a 2xx status code +func (o *ListPoliciesDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list policies default response has a 3xx status code +func (o *ListPoliciesDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list policies default response has a 4xx status code +func (o *ListPoliciesDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list policies default response has a 5xx status code +func (o *ListPoliciesDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list policies default response a status code equal to that given +func (o *ListPoliciesDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the list policies default response +func (o *ListPoliciesDefault) Code() int { + return o._statusCode +} + +func (o *ListPoliciesDefault) Error() string { + return fmt.Sprintf("[GET /v1/volume/qos][%d] listPolicies default %+v", o._statusCode, o.Payload) +} + +func (o *ListPoliciesDefault) String() string { + return fmt.Sprintf("[GET /v1/volume/qos][%d] listPolicies default %+v", o._statusCode, o.Payload) +} + +func (o *ListPoliciesDefault) GetPayload() *httperrors.HTTPErrorResponse { + return o.Payload +} + +func (o *ListPoliciesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(httperrors.HTTPErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/api/client/volume/set_volume_qo_s_policy_parameters.go b/api/client/volume/set_volume_qo_s_policy_parameters.go new file mode 100644 index 0000000..4c2ef4c --- /dev/null +++ b/api/client/volume/set_volume_qo_s_policy_parameters.go @@ -0,0 +1,172 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package volume + +// 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" + + "github.com/fi-ts/cloud-go/api/models" +) + +// NewSetVolumeQoSPolicyParams creates a new SetVolumeQoSPolicyParams 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 NewSetVolumeQoSPolicyParams() *SetVolumeQoSPolicyParams { + return &SetVolumeQoSPolicyParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewSetVolumeQoSPolicyParamsWithTimeout creates a new SetVolumeQoSPolicyParams object +// with the ability to set a timeout on a request. +func NewSetVolumeQoSPolicyParamsWithTimeout(timeout time.Duration) *SetVolumeQoSPolicyParams { + return &SetVolumeQoSPolicyParams{ + timeout: timeout, + } +} + +// NewSetVolumeQoSPolicyParamsWithContext creates a new SetVolumeQoSPolicyParams object +// with the ability to set a context for a request. +func NewSetVolumeQoSPolicyParamsWithContext(ctx context.Context) *SetVolumeQoSPolicyParams { + return &SetVolumeQoSPolicyParams{ + Context: ctx, + } +} + +// NewSetVolumeQoSPolicyParamsWithHTTPClient creates a new SetVolumeQoSPolicyParams object +// with the ability to set a custom HTTPClient for a request. +func NewSetVolumeQoSPolicyParamsWithHTTPClient(client *http.Client) *SetVolumeQoSPolicyParams { + return &SetVolumeQoSPolicyParams{ + HTTPClient: client, + } +} + +/* +SetVolumeQoSPolicyParams contains all the parameters to send to the API endpoint + + for the set volume qo s policy operation. + + Typically these are written to a http.Request. +*/ +type SetVolumeQoSPolicyParams struct { + + // Body. + Body *models.V1VolumeSetQoSPolicyRequest + + /* ID. + + identifier of the volume + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the set volume qo s policy params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *SetVolumeQoSPolicyParams) WithDefaults() *SetVolumeQoSPolicyParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the set volume qo s policy params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *SetVolumeQoSPolicyParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the set volume qo s policy params +func (o *SetVolumeQoSPolicyParams) WithTimeout(timeout time.Duration) *SetVolumeQoSPolicyParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the set volume qo s policy params +func (o *SetVolumeQoSPolicyParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the set volume qo s policy params +func (o *SetVolumeQoSPolicyParams) WithContext(ctx context.Context) *SetVolumeQoSPolicyParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the set volume qo s policy params +func (o *SetVolumeQoSPolicyParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the set volume qo s policy params +func (o *SetVolumeQoSPolicyParams) WithHTTPClient(client *http.Client) *SetVolumeQoSPolicyParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the set volume qo s policy params +func (o *SetVolumeQoSPolicyParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the set volume qo s policy params +func (o *SetVolumeQoSPolicyParams) WithBody(body *models.V1VolumeSetQoSPolicyRequest) *SetVolumeQoSPolicyParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the set volume qo s policy params +func (o *SetVolumeQoSPolicyParams) SetBody(body *models.V1VolumeSetQoSPolicyRequest) { + o.Body = body +} + +// WithID adds the id to the set volume qo s policy params +func (o *SetVolumeQoSPolicyParams) WithID(id string) *SetVolumeQoSPolicyParams { + o.SetID(id) + return o +} + +// SetID adds the id to the set volume qo s policy params +func (o *SetVolumeQoSPolicyParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *SetVolumeQoSPolicyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/api/client/volume/set_volume_qo_s_policy_responses.go b/api/client/volume/set_volume_qo_s_policy_responses.go new file mode 100644 index 0000000..e6af016 --- /dev/null +++ b/api/client/volume/set_volume_qo_s_policy_responses.go @@ -0,0 +1,183 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package volume + +// 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/fi-ts/cloud-go/api/models" + "github.com/metal-stack/metal-lib/httperrors" +) + +// SetVolumeQoSPolicyReader is a Reader for the SetVolumeQoSPolicy structure. +type SetVolumeQoSPolicyReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *SetVolumeQoSPolicyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewSetVolumeQoSPolicyOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewSetVolumeQoSPolicyDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewSetVolumeQoSPolicyOK creates a SetVolumeQoSPolicyOK with default headers values +func NewSetVolumeQoSPolicyOK() *SetVolumeQoSPolicyOK { + return &SetVolumeQoSPolicyOK{} +} + +/* +SetVolumeQoSPolicyOK describes a response with status code 200, with default header values. + +OK +*/ +type SetVolumeQoSPolicyOK struct { + Payload *models.V1VolumeResponse +} + +// IsSuccess returns true when this set volume qo s policy o k response has a 2xx status code +func (o *SetVolumeQoSPolicyOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this set volume qo s policy o k response has a 3xx status code +func (o *SetVolumeQoSPolicyOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this set volume qo s policy o k response has a 4xx status code +func (o *SetVolumeQoSPolicyOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this set volume qo s policy o k response has a 5xx status code +func (o *SetVolumeQoSPolicyOK) IsServerError() bool { + return false +} + +// IsCode returns true when this set volume qo s policy o k response a status code equal to that given +func (o *SetVolumeQoSPolicyOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the set volume qo s policy o k response +func (o *SetVolumeQoSPolicyOK) Code() int { + return 200 +} + +func (o *SetVolumeQoSPolicyOK) Error() string { + return fmt.Sprintf("[POST /v1/volume/{id}/qos][%d] setVolumeQoSPolicyOK %+v", 200, o.Payload) +} + +func (o *SetVolumeQoSPolicyOK) String() string { + return fmt.Sprintf("[POST /v1/volume/{id}/qos][%d] setVolumeQoSPolicyOK %+v", 200, o.Payload) +} + +func (o *SetVolumeQoSPolicyOK) GetPayload() *models.V1VolumeResponse { + return o.Payload +} + +func (o *SetVolumeQoSPolicyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.V1VolumeResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewSetVolumeQoSPolicyDefault creates a SetVolumeQoSPolicyDefault with default headers values +func NewSetVolumeQoSPolicyDefault(code int) *SetVolumeQoSPolicyDefault { + return &SetVolumeQoSPolicyDefault{ + _statusCode: code, + } +} + +/* +SetVolumeQoSPolicyDefault describes a response with status code -1, with default header values. + +Error +*/ +type SetVolumeQoSPolicyDefault struct { + _statusCode int + + Payload *httperrors.HTTPErrorResponse +} + +// IsSuccess returns true when this set volume qo s policy default response has a 2xx status code +func (o *SetVolumeQoSPolicyDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this set volume qo s policy default response has a 3xx status code +func (o *SetVolumeQoSPolicyDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this set volume qo s policy default response has a 4xx status code +func (o *SetVolumeQoSPolicyDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this set volume qo s policy default response has a 5xx status code +func (o *SetVolumeQoSPolicyDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this set volume qo s policy default response a status code equal to that given +func (o *SetVolumeQoSPolicyDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the set volume qo s policy default response +func (o *SetVolumeQoSPolicyDefault) Code() int { + return o._statusCode +} + +func (o *SetVolumeQoSPolicyDefault) Error() string { + return fmt.Sprintf("[POST /v1/volume/{id}/qos][%d] setVolumeQoSPolicy default %+v", o._statusCode, o.Payload) +} + +func (o *SetVolumeQoSPolicyDefault) String() string { + return fmt.Sprintf("[POST /v1/volume/{id}/qos][%d] setVolumeQoSPolicy default %+v", o._statusCode, o.Payload) +} + +func (o *SetVolumeQoSPolicyDefault) GetPayload() *httperrors.HTTPErrorResponse { + return o.Payload +} + +func (o *SetVolumeQoSPolicyDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(httperrors.HTTPErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/api/client/volume/volume_client.go b/api/client/volume/volume_client.go index 539cde6..777258f 100644 --- a/api/client/volume/volume_client.go +++ b/api/client/volume/volume_client.go @@ -42,8 +42,12 @@ type ClientService interface { GetVolume(params *GetVolumeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetVolumeOK, error) + ListPolicies(params *ListPoliciesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListPoliciesOK, error) + ListVolumes(params *ListVolumesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListVolumesOK, error) + SetVolumeQoSPolicy(params *SetVolumeQoSPolicyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*SetVolumeQoSPolicyOK, error) + SetTransport(transport runtime.ClientTransport) } @@ -313,6 +317,44 @@ func (a *Client) GetVolume(params *GetVolumeParams, authInfo runtime.ClientAuthI return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +ListPolicies gets all policies +*/ +func (a *Client) ListPolicies(params *ListPoliciesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListPoliciesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListPoliciesParams() + } + op := &runtime.ClientOperation{ + ID: "listPolicies", + Method: "GET", + PathPattern: "/v1/volume/qos", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ListPoliciesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListPoliciesOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListPoliciesDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* ListVolumes gets all volumes */ @@ -351,6 +393,44 @@ func (a *Client) ListVolumes(params *ListVolumesParams, authInfo runtime.ClientA return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +SetVolumeQoSPolicy updates volume qos policy +*/ +func (a *Client) SetVolumeQoSPolicy(params *SetVolumeQoSPolicyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*SetVolumeQoSPolicyOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewSetVolumeQoSPolicyParams() + } + op := &runtime.ClientOperation{ + ID: "setVolumeQoSPolicy", + Method: "POST", + PathPattern: "/v1/volume/{id}/qos", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &SetVolumeQoSPolicyReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*SetVolumeQoSPolicyOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*SetVolumeQoSPolicyDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + // SetTransport changes the transport on the client func (a *Client) SetTransport(transport runtime.ClientTransport) { a.transport = transport diff --git a/api/models/rest_health_response.go b/api/models/rest_health_response.go index a7d989d..c09001d 100644 --- a/api/models/rest_health_response.go +++ b/api/models/rest_health_response.go @@ -24,8 +24,7 @@ type RestHealthResponse struct { Message *string `json:"message"` // services - // Required: true - Services map[string]RestHealthResult `json:"services"` + Services map[string]RestHealthResult `json:"services,omitempty"` // status // Required: true @@ -64,9 +63,8 @@ func (m *RestHealthResponse) validateMessage(formats strfmt.Registry) error { } func (m *RestHealthResponse) validateServices(formats strfmt.Registry) error { - - if err := validate.Required("services", "body", m.Services); err != nil { - return err + if swag.IsZero(m.Services) { // not required + return nil } for k := range m.Services { @@ -115,10 +113,6 @@ func (m *RestHealthResponse) ContextValidate(ctx context.Context, formats strfmt func (m *RestHealthResponse) contextValidateServices(ctx context.Context, formats strfmt.Registry) error { - if err := validate.Required("services", "body", m.Services); err != nil { - return err - } - for k := range m.Services { if val, ok := m.Services[k]; ok { diff --git a/api/models/rest_health_result.go b/api/models/rest_health_result.go index e7e8e5f..6f06e4e 100644 --- a/api/models/rest_health_result.go +++ b/api/models/rest_health_result.go @@ -24,8 +24,7 @@ type RestHealthResult struct { Message *string `json:"message"` // services - // Required: true - Services map[string]RestHealthResult `json:"services"` + Services map[string]RestHealthResult `json:"services,omitempty"` // status // Required: true @@ -64,9 +63,8 @@ func (m *RestHealthResult) validateMessage(formats strfmt.Registry) error { } func (m *RestHealthResult) validateServices(formats strfmt.Registry) error { - - if err := validate.Required("services", "body", m.Services); err != nil { - return err + if swag.IsZero(m.Services) { // not required + return nil } for k := range m.Services { @@ -115,10 +113,6 @@ func (m *RestHealthResult) ContextValidate(ctx context.Context, formats strfmt.R func (m *RestHealthResult) contextValidateServices(ctx context.Context, formats strfmt.Registry) error { - if err := validate.Required("services", "body", m.Services); err != nil { - return err - } - for k := range m.Services { if val, ok := m.Services[k]; ok { diff --git a/api/models/v1_postgres_secrets_respone.go b/api/models/v1_postgres_secrets_response.go similarity index 70% rename from api/models/v1_postgres_secrets_respone.go rename to api/models/v1_postgres_secrets_response.go index 4f438ff..5b3c2b1 100644 --- a/api/models/v1_postgres_secrets_respone.go +++ b/api/models/v1_postgres_secrets_response.go @@ -14,17 +14,17 @@ import ( "github.com/go-openapi/swag" ) -// V1PostgresSecretsRespone v1 postgres secrets respone +// V1PostgresSecretsResponse v1 postgres secrets response // -// swagger:model v1.PostgresSecretsRespone -type V1PostgresSecretsRespone struct { +// swagger:model v1.PostgresSecretsResponse +type V1PostgresSecretsResponse struct { // user secret UserSecret []*V1UserSecret `json:"userSecret"` } -// Validate validates this v1 postgres secrets respone -func (m *V1PostgresSecretsRespone) Validate(formats strfmt.Registry) error { +// Validate validates this v1 postgres secrets response +func (m *V1PostgresSecretsResponse) Validate(formats strfmt.Registry) error { var res []error if err := m.validateUserSecret(formats); err != nil { @@ -37,7 +37,7 @@ func (m *V1PostgresSecretsRespone) Validate(formats strfmt.Registry) error { return nil } -func (m *V1PostgresSecretsRespone) validateUserSecret(formats strfmt.Registry) error { +func (m *V1PostgresSecretsResponse) validateUserSecret(formats strfmt.Registry) error { if swag.IsZero(m.UserSecret) { // not required return nil } @@ -63,8 +63,8 @@ func (m *V1PostgresSecretsRespone) validateUserSecret(formats strfmt.Registry) e return nil } -// ContextValidate validate this v1 postgres secrets respone based on the context it is used -func (m *V1PostgresSecretsRespone) ContextValidate(ctx context.Context, formats strfmt.Registry) error { +// ContextValidate validate this v1 postgres secrets response based on the context it is used +func (m *V1PostgresSecretsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateUserSecret(ctx, formats); err != nil { @@ -77,7 +77,7 @@ func (m *V1PostgresSecretsRespone) ContextValidate(ctx context.Context, formats return nil } -func (m *V1PostgresSecretsRespone) contextValidateUserSecret(ctx context.Context, formats strfmt.Registry) error { +func (m *V1PostgresSecretsResponse) contextValidateUserSecret(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.UserSecret); i++ { @@ -103,7 +103,7 @@ func (m *V1PostgresSecretsRespone) contextValidateUserSecret(ctx context.Context } // MarshalBinary interface implementation -func (m *V1PostgresSecretsRespone) MarshalBinary() ([]byte, error) { +func (m *V1PostgresSecretsResponse) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } @@ -111,8 +111,8 @@ func (m *V1PostgresSecretsRespone) MarshalBinary() ([]byte, error) { } // UnmarshalBinary interface implementation -func (m *V1PostgresSecretsRespone) UnmarshalBinary(b []byte) error { - var res V1PostgresSecretsRespone +func (m *V1PostgresSecretsResponse) UnmarshalBinary(b []byte) error { + var res V1PostgresSecretsResponse if err := swag.ReadJSON(b, &res); err != nil { return err } diff --git a/api/models/v1_qo_s_policy_limit.go b/api/models/v1_qo_s_policy_limit.go new file mode 100644 index 0000000..3948011 --- /dev/null +++ b/api/models/v1_qo_s_policy_limit.go @@ -0,0 +1,206 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// V1QoSPolicyLimit v1 qo s policy limit +// +// swagger:model v1.QoSPolicyLimit +type V1QoSPolicyLimit struct { + + // bandwidth + // Required: true + Bandwidth *V1QoSPolicyLimitBandwidth `json:"Bandwidth"` + + // i o p s + // Required: true + IOPS *V1QoSPolicyLimitIOPS `json:"IOPS"` + + // i o p s per g b + // Required: true + IOPSPerGB *V1QoSPolicyLimitIOPSPerGB `json:"IOPSPerGB"` +} + +// Validate validates this v1 qo s policy limit +func (m *V1QoSPolicyLimit) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBandwidth(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIOPS(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIOPSPerGB(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1QoSPolicyLimit) validateBandwidth(formats strfmt.Registry) error { + + if err := validate.Required("Bandwidth", "body", m.Bandwidth); err != nil { + return err + } + + if m.Bandwidth != nil { + if err := m.Bandwidth.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Bandwidth") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Bandwidth") + } + return err + } + } + + return nil +} + +func (m *V1QoSPolicyLimit) validateIOPS(formats strfmt.Registry) error { + + if err := validate.Required("IOPS", "body", m.IOPS); err != nil { + return err + } + + if m.IOPS != nil { + if err := m.IOPS.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("IOPS") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("IOPS") + } + return err + } + } + + return nil +} + +func (m *V1QoSPolicyLimit) validateIOPSPerGB(formats strfmt.Registry) error { + + if err := validate.Required("IOPSPerGB", "body", m.IOPSPerGB); err != nil { + return err + } + + if m.IOPSPerGB != nil { + if err := m.IOPSPerGB.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("IOPSPerGB") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("IOPSPerGB") + } + return err + } + } + + return nil +} + +// ContextValidate validate this v1 qo s policy limit based on the context it is used +func (m *V1QoSPolicyLimit) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBandwidth(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIOPS(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIOPSPerGB(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1QoSPolicyLimit) contextValidateBandwidth(ctx context.Context, formats strfmt.Registry) error { + + if m.Bandwidth != nil { + + if err := m.Bandwidth.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Bandwidth") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Bandwidth") + } + return err + } + } + + return nil +} + +func (m *V1QoSPolicyLimit) contextValidateIOPS(ctx context.Context, formats strfmt.Registry) error { + + if m.IOPS != nil { + + if err := m.IOPS.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("IOPS") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("IOPS") + } + return err + } + } + + return nil +} + +func (m *V1QoSPolicyLimit) contextValidateIOPSPerGB(ctx context.Context, formats strfmt.Registry) error { + + if m.IOPSPerGB != nil { + + if err := m.IOPSPerGB.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("IOPSPerGB") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("IOPSPerGB") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *V1QoSPolicyLimit) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1QoSPolicyLimit) UnmarshalBinary(b []byte) error { + var res V1QoSPolicyLimit + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_qo_s_policy_limit_bandwidth.go b/api/models/v1_qo_s_policy_limit_bandwidth.go new file mode 100644 index 0000000..42d23b5 --- /dev/null +++ b/api/models/v1_qo_s_policy_limit_bandwidth.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// V1QoSPolicyLimitBandwidth v1 qo s policy limit bandwidth +// +// swagger:model v1.QoSPolicyLimitBandwidth +type V1QoSPolicyLimitBandwidth struct { + + // read + // Required: true + Read *int64 `json:"Read"` + + // write + // Required: true + Write *int64 `json:"Write"` +} + +// Validate validates this v1 qo s policy limit bandwidth +func (m *V1QoSPolicyLimitBandwidth) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRead(formats); err != nil { + res = append(res, err) + } + + if err := m.validateWrite(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1QoSPolicyLimitBandwidth) validateRead(formats strfmt.Registry) error { + + if err := validate.Required("Read", "body", m.Read); err != nil { + return err + } + + return nil +} + +func (m *V1QoSPolicyLimitBandwidth) validateWrite(formats strfmt.Registry) error { + + if err := validate.Required("Write", "body", m.Write); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this v1 qo s policy limit bandwidth based on context it is used +func (m *V1QoSPolicyLimitBandwidth) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *V1QoSPolicyLimitBandwidth) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1QoSPolicyLimitBandwidth) UnmarshalBinary(b []byte) error { + var res V1QoSPolicyLimitBandwidth + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_qo_s_policy_limit_i_o_p_s.go b/api/models/v1_qo_s_policy_limit_i_o_p_s.go new file mode 100644 index 0000000..63a53f1 --- /dev/null +++ b/api/models/v1_qo_s_policy_limit_i_o_p_s.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// V1QoSPolicyLimitIOPS v1 qo s policy limit i o p s +// +// swagger:model v1.QoSPolicyLimitIOPS +type V1QoSPolicyLimitIOPS struct { + + // read + // Required: true + Read *int64 `json:"Read"` + + // write + // Required: true + Write *int64 `json:"Write"` +} + +// Validate validates this v1 qo s policy limit i o p s +func (m *V1QoSPolicyLimitIOPS) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRead(formats); err != nil { + res = append(res, err) + } + + if err := m.validateWrite(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1QoSPolicyLimitIOPS) validateRead(formats strfmt.Registry) error { + + if err := validate.Required("Read", "body", m.Read); err != nil { + return err + } + + return nil +} + +func (m *V1QoSPolicyLimitIOPS) validateWrite(formats strfmt.Registry) error { + + if err := validate.Required("Write", "body", m.Write); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this v1 qo s policy limit i o p s based on context it is used +func (m *V1QoSPolicyLimitIOPS) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *V1QoSPolicyLimitIOPS) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1QoSPolicyLimitIOPS) UnmarshalBinary(b []byte) error { + var res V1QoSPolicyLimitIOPS + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_qo_s_policy_limit_i_o_p_s_per_g_b.go b/api/models/v1_qo_s_policy_limit_i_o_p_s_per_g_b.go new file mode 100644 index 0000000..e5f1c14 --- /dev/null +++ b/api/models/v1_qo_s_policy_limit_i_o_p_s_per_g_b.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// V1QoSPolicyLimitIOPSPerGB v1 qo s policy limit i o p s per g b +// +// swagger:model v1.QoSPolicyLimitIOPSPerGB +type V1QoSPolicyLimitIOPSPerGB struct { + + // read + // Required: true + Read *int64 `json:"Read"` + + // write + // Required: true + Write *int64 `json:"Write"` +} + +// Validate validates this v1 qo s policy limit i o p s per g b +func (m *V1QoSPolicyLimitIOPSPerGB) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRead(formats); err != nil { + res = append(res, err) + } + + if err := m.validateWrite(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1QoSPolicyLimitIOPSPerGB) validateRead(formats strfmt.Registry) error { + + if err := validate.Required("Read", "body", m.Read); err != nil { + return err + } + + return nil +} + +func (m *V1QoSPolicyLimitIOPSPerGB) validateWrite(formats strfmt.Registry) error { + + if err := validate.Required("Write", "body", m.Write); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this v1 qo s policy limit i o p s per g b based on context it is used +func (m *V1QoSPolicyLimitIOPSPerGB) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *V1QoSPolicyLimitIOPSPerGB) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1QoSPolicyLimitIOPSPerGB) UnmarshalBinary(b []byte) error { + var res V1QoSPolicyLimitIOPSPerGB + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_qo_s_policy_response.go b/api/models/v1_qo_s_policy_response.go new file mode 100644 index 0000000..b287420 --- /dev/null +++ b/api/models/v1_qo_s_policy_response.go @@ -0,0 +1,193 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// V1QoSPolicyResponse v1 qo s policy response +// +// swagger:model v1.QoSPolicyResponse +type V1QoSPolicyResponse struct { + + // description + // Required: true + Description *string `json:"Description"` + + // limit + // Required: true + Limit *V1QoSPolicyLimit `json:"Limit"` + + // name + // Required: true + Name *string `json:"Name"` + + // partition + // Required: true + Partition *string `json:"Partition"` + + // qo s policy ID + // Required: true + QoSPolicyID *string `json:"QoSPolicyID"` + + // state + // Required: true + State *string `json:"State"` +} + +// Validate validates this v1 qo s policy response +func (m *V1QoSPolicyResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLimit(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePartition(formats); err != nil { + res = append(res, err) + } + + if err := m.validateQoSPolicyID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateState(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1QoSPolicyResponse) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("Description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *V1QoSPolicyResponse) validateLimit(formats strfmt.Registry) error { + + if err := validate.Required("Limit", "body", m.Limit); err != nil { + return err + } + + if m.Limit != nil { + if err := m.Limit.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Limit") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Limit") + } + return err + } + } + + return nil +} + +func (m *V1QoSPolicyResponse) validateName(formats strfmt.Registry) error { + + if err := validate.Required("Name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *V1QoSPolicyResponse) validatePartition(formats strfmt.Registry) error { + + if err := validate.Required("Partition", "body", m.Partition); err != nil { + return err + } + + return nil +} + +func (m *V1QoSPolicyResponse) validateQoSPolicyID(formats strfmt.Registry) error { + + if err := validate.Required("QoSPolicyID", "body", m.QoSPolicyID); err != nil { + return err + } + + return nil +} + +func (m *V1QoSPolicyResponse) validateState(formats strfmt.Registry) error { + + if err := validate.Required("State", "body", m.State); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this v1 qo s policy response based on the context it is used +func (m *V1QoSPolicyResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLimit(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1QoSPolicyResponse) contextValidateLimit(ctx context.Context, formats strfmt.Registry) error { + + if m.Limit != nil { + + if err := m.Limit.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Limit") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Limit") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *V1QoSPolicyResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1QoSPolicyResponse) UnmarshalBinary(b []byte) error { + var res V1QoSPolicyResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_volume_set_qo_s_policy_request.go b/api/models/v1_volume_set_qo_s_policy_request.go new file mode 100644 index 0000000..5a3f0b5 --- /dev/null +++ b/api/models/v1_volume_set_qo_s_policy_request.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// V1VolumeSetQoSPolicyRequest v1 volume set qo s policy request +// +// swagger:model v1.VolumeSetQoSPolicyRequest +type V1VolumeSetQoSPolicyRequest struct { + + // qo s policy ID + // Required: true + QoSPolicyID *string `json:"QoSPolicyID"` + + // qo s policy name + // Required: true + QoSPolicyName *string `json:"QoSPolicyName"` +} + +// Validate validates this v1 volume set qo s policy request +func (m *V1VolumeSetQoSPolicyRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateQoSPolicyID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateQoSPolicyName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1VolumeSetQoSPolicyRequest) validateQoSPolicyID(formats strfmt.Registry) error { + + if err := validate.Required("QoSPolicyID", "body", m.QoSPolicyID); err != nil { + return err + } + + return nil +} + +func (m *V1VolumeSetQoSPolicyRequest) validateQoSPolicyName(formats strfmt.Registry) error { + + if err := validate.Required("QoSPolicyName", "body", m.QoSPolicyName); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this v1 volume set qo s policy request based on context it is used +func (m *V1VolumeSetQoSPolicyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *V1VolumeSetQoSPolicyRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1VolumeSetQoSPolicyRequest) UnmarshalBinary(b []byte) error { + var res V1VolumeSetQoSPolicyRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/cloud-api.json b/cloud-api.json index a679461..3d4982c 100644 --- a/cloud-api.json +++ b/cloud-api.json @@ -1101,7 +1101,6 @@ }, "required": [ "message", - "services", "status" ] }, @@ -1122,7 +1121,6 @@ }, "required": [ "message", - "services", "status" ] }, @@ -3738,7 +3736,7 @@ "sourceId" ] }, - "v1.PostgresSecretsRespone": { + "v1.PostgresSecretsResponse": { "properties": { "userSecret": { "items": { @@ -4354,6 +4352,102 @@ } } }, + "v1.QoSPolicyLimit": { + "properties": { + "Bandwidth": { + "$ref": "#/definitions/v1.QoSPolicyLimitBandwidth" + }, + "IOPS": { + "$ref": "#/definitions/v1.QoSPolicyLimitIOPS" + }, + "IOPSPerGB": { + "$ref": "#/definitions/v1.QoSPolicyLimitIOPSPerGB" + } + }, + "required": [ + "Bandwidth", + "IOPS", + "IOPSPerGB" + ] + }, + "v1.QoSPolicyLimitBandwidth": { + "properties": { + "Read": { + "format": "integer", + "type": "integer" + }, + "Write": { + "format": "integer", + "type": "integer" + } + }, + "required": [ + "Read", + "Write" + ] + }, + "v1.QoSPolicyLimitIOPS": { + "properties": { + "Read": { + "format": "integer", + "type": "integer" + }, + "Write": { + "format": "integer", + "type": "integer" + } + }, + "required": [ + "Read", + "Write" + ] + }, + "v1.QoSPolicyLimitIOPSPerGB": { + "properties": { + "Read": { + "format": "integer", + "type": "integer" + }, + "Write": { + "format": "integer", + "type": "integer" + } + }, + "required": [ + "Read", + "Write" + ] + }, + "v1.QoSPolicyResponse": { + "properties": { + "Description": { + "type": "string" + }, + "Limit": { + "$ref": "#/definitions/v1.QoSPolicyLimit" + }, + "Name": { + "type": "string" + }, + "Partition": { + "type": "string" + }, + "QoSPolicyID": { + "type": "string" + }, + "State": { + "type": "string" + } + }, + "required": [ + "Description", + "Limit", + "Name", + "Partition", + "QoSPolicyID", + "State" + ] + }, "v1.Quota": { "properties": { "quota": { @@ -5448,6 +5542,20 @@ "VolumeName" ] }, + "v1.VolumeSetQoSPolicyRequest": { + "properties": { + "QoSPolicyID": { + "type": "string" + }, + "QoSPolicyName": { + "type": "string" + } + }, + "required": [ + "QoSPolicyID", + "QoSPolicyName" + ] + }, "v1.VolumeStatistics": { "properties": { "CompressionRatio": { @@ -7293,7 +7401,7 @@ } } }, - "summary": "trigger cluster reconcilation ", + "summary": "trigger cluster reconciliation ", "tags": [ "cluster" ] @@ -8109,7 +8217,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.PostgresSecretsRespone" + "$ref": "#/definitions/v1.PostgresSecretsResponse" } }, "default": { @@ -9187,6 +9295,38 @@ ] } }, + "/v1/volume/qos": { + "get": { + "consumes": [ + "application/json" + ], + "operationId": "listPolicies", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "items": { + "$ref": "#/definitions/v1.QoSPolicyResponse" + }, + "type": "array" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "#/definitions/httperrors.HTTPErrorResponse" + } + } + }, + "summary": "get all policies", + "tags": [ + "volume" + ] + } + }, "/v1/volume/snapshot/find": { "post": { "consumes": [ @@ -9388,6 +9528,52 @@ "volume" ] } + }, + "/v1/volume/{id}/qos": { + "post": { + "consumes": [ + "application/json" + ], + "operationId": "setVolumeQoSPolicy", + "parameters": [ + { + "description": "identifier of the volume", + "in": "path", + "name": "id", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.VolumeSetQoSPolicyRequest" + } + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1.VolumeResponse" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "#/definitions/httperrors.HTTPErrorResponse" + } + } + }, + "summary": "update volume qos policy", + "tags": [ + "volume" + ] + } } }, "security": [ diff --git a/test/mocks/volume/ClientService.go b/test/mocks/volume/ClientService.go index e65888d..5deabc2 100644 --- a/test/mocks/volume/ClientService.go +++ b/test/mocks/volume/ClientService.go @@ -273,6 +273,43 @@ func (_m *ClientService) GetVolume(params *clientvolume.GetVolumeParams, authInf return r0, r1 } +// ListPolicies provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) ListPolicies(params *clientvolume.ListPoliciesParams, authInfo runtime.ClientAuthInfoWriter, opts ...clientvolume.ClientOption) (*clientvolume.ListPoliciesOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for ListPolicies") + } + + var r0 *clientvolume.ListPoliciesOK + var r1 error + if rf, ok := ret.Get(0).(func(*clientvolume.ListPoliciesParams, runtime.ClientAuthInfoWriter, ...clientvolume.ClientOption) (*clientvolume.ListPoliciesOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*clientvolume.ListPoliciesParams, runtime.ClientAuthInfoWriter, ...clientvolume.ClientOption) *clientvolume.ListPoliciesOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*clientvolume.ListPoliciesOK) + } + } + + if rf, ok := ret.Get(1).(func(*clientvolume.ListPoliciesParams, runtime.ClientAuthInfoWriter, ...clientvolume.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // ListVolumes provides a mock function with given fields: params, authInfo, opts func (_m *ClientService) ListVolumes(params *clientvolume.ListVolumesParams, authInfo runtime.ClientAuthInfoWriter, opts ...clientvolume.ClientOption) (*clientvolume.ListVolumesOK, error) { _va := make([]interface{}, len(opts)) @@ -315,6 +352,43 @@ func (_m *ClientService) SetTransport(transport runtime.ClientTransport) { _m.Called(transport) } +// SetVolumeQoSPolicy provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) SetVolumeQoSPolicy(params *clientvolume.SetVolumeQoSPolicyParams, authInfo runtime.ClientAuthInfoWriter, opts ...clientvolume.ClientOption) (*clientvolume.SetVolumeQoSPolicyOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for SetVolumeQoSPolicy") + } + + var r0 *clientvolume.SetVolumeQoSPolicyOK + var r1 error + if rf, ok := ret.Get(0).(func(*clientvolume.SetVolumeQoSPolicyParams, runtime.ClientAuthInfoWriter, ...clientvolume.ClientOption) (*clientvolume.SetVolumeQoSPolicyOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*clientvolume.SetVolumeQoSPolicyParams, runtime.ClientAuthInfoWriter, ...clientvolume.ClientOption) *clientvolume.SetVolumeQoSPolicyOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*clientvolume.SetVolumeQoSPolicyOK) + } + } + + if rf, ok := ret.Get(1).(func(*clientvolume.SetVolumeQoSPolicyParams, runtime.ClientAuthInfoWriter, ...clientvolume.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // NewClientService creates a new instance of ClientService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewClientService(t interface {