diff --git a/power/client/snapshots/snapshots_client.go b/power/client/snapshots/snapshots_client.go index dc26c54c..a4864748 100644 --- a/power/client/snapshots/snapshots_client.go +++ b/power/client/snapshots/snapshots_client.go @@ -60,11 +60,19 @@ type ClientService interface { V1SnapshotsGetall(params *V1SnapshotsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1SnapshotsGetallOK, error) + V1VolumeSnapshotsGet(params *V1VolumeSnapshotsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1VolumeSnapshotsGetOK, error) + + V1VolumeSnapshotsGetall(params *V1VolumeSnapshotsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1VolumeSnapshotsGetallOK, error) + SetTransport(transport runtime.ClientTransport) } /* -V1SnapshotsGet gets the detail of a snapshot + V1SnapshotsGet gets the detail of a snapshot + + This API is deprecated for /v1/snapshots. + +The API v1/volume-snapshots has replaced this endpoint. View the usage of a snapshot. The snapshot may take time sync because the data is cached. */ @@ -105,7 +113,11 @@ func (a *Client) V1SnapshotsGet(params *V1SnapshotsGetParams, authInfo runtime.C } /* -V1SnapshotsGetall gets a list of all the snapshots on a workspace + V1SnapshotsGetall gets a list of all the snapshots on a workspace + + This API is deprecated for /v1/snapshots. + +The API v1/volume-snapshots has replaced this endpoint. View the usage of snapshots on the workspace. The snapshots may take time sync because the data is cached. */ @@ -145,6 +157,88 @@ func (a *Client) V1SnapshotsGetall(params *V1SnapshotsGetallParams, authInfo run panic(msg) } +/* +V1VolumeSnapshotsGet gets the detail of a volume snapshot + +View the usage of a snapshot. The snapshot may take time sync because the data is cached. +*/ +func (a *Client) V1VolumeSnapshotsGet(params *V1VolumeSnapshotsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1VolumeSnapshotsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1VolumeSnapshotsGetParams() + } + op := &runtime.ClientOperation{ + ID: "v1.volume-snapshots.get", + Method: "GET", + PathPattern: "/v1/volume-snapshots/{volume_snapshot_uuid}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1VolumeSnapshotsGetReader{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.(*V1VolumeSnapshotsGetOK) + 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 v1.volume-snapshots.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1VolumeSnapshotsGetall gets the list of volume snapshots on a workspace + +View the usage of volume snapshots on the workspace. The volume snapshots may take time sync because the data is cached. +*/ +func (a *Client) V1VolumeSnapshotsGetall(params *V1VolumeSnapshotsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1VolumeSnapshotsGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1VolumeSnapshotsGetallParams() + } + op := &runtime.ClientOperation{ + ID: "v1.volume-snapshots.getall", + Method: "GET", + PathPattern: "/v1/volume-snapshots", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1VolumeSnapshotsGetallReader{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.(*V1VolumeSnapshotsGetallOK) + 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 v1.volume-snapshots.getall: 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/power/client/snapshots/v1_volume_snapshots_get_parameters.go b/power/client/snapshots/v1_volume_snapshots_get_parameters.go new file mode 100644 index 00000000..2d739ce6 --- /dev/null +++ b/power/client/snapshots/v1_volume_snapshots_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package snapshots + +// 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" +) + +// NewV1VolumeSnapshotsGetParams creates a new V1VolumeSnapshotsGetParams 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 NewV1VolumeSnapshotsGetParams() *V1VolumeSnapshotsGetParams { + return &V1VolumeSnapshotsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1VolumeSnapshotsGetParamsWithTimeout creates a new V1VolumeSnapshotsGetParams object +// with the ability to set a timeout on a request. +func NewV1VolumeSnapshotsGetParamsWithTimeout(timeout time.Duration) *V1VolumeSnapshotsGetParams { + return &V1VolumeSnapshotsGetParams{ + timeout: timeout, + } +} + +// NewV1VolumeSnapshotsGetParamsWithContext creates a new V1VolumeSnapshotsGetParams object +// with the ability to set a context for a request. +func NewV1VolumeSnapshotsGetParamsWithContext(ctx context.Context) *V1VolumeSnapshotsGetParams { + return &V1VolumeSnapshotsGetParams{ + Context: ctx, + } +} + +// NewV1VolumeSnapshotsGetParamsWithHTTPClient creates a new V1VolumeSnapshotsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1VolumeSnapshotsGetParamsWithHTTPClient(client *http.Client) *V1VolumeSnapshotsGetParams { + return &V1VolumeSnapshotsGetParams{ + HTTPClient: client, + } +} + +/* +V1VolumeSnapshotsGetParams contains all the parameters to send to the API endpoint + + for the v1 volume snapshots get operation. + + Typically these are written to a http.Request. +*/ +type V1VolumeSnapshotsGetParams struct { + + /* VolumeSnapshotUUID. + + The volume snapshot UUID + */ + VolumeSnapshotUUID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 volume snapshots get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1VolumeSnapshotsGetParams) WithDefaults() *V1VolumeSnapshotsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 volume snapshots get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1VolumeSnapshotsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 volume snapshots get params +func (o *V1VolumeSnapshotsGetParams) WithTimeout(timeout time.Duration) *V1VolumeSnapshotsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 volume snapshots get params +func (o *V1VolumeSnapshotsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 volume snapshots get params +func (o *V1VolumeSnapshotsGetParams) WithContext(ctx context.Context) *V1VolumeSnapshotsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 volume snapshots get params +func (o *V1VolumeSnapshotsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 volume snapshots get params +func (o *V1VolumeSnapshotsGetParams) WithHTTPClient(client *http.Client) *V1VolumeSnapshotsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 volume snapshots get params +func (o *V1VolumeSnapshotsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithVolumeSnapshotUUID adds the volumeSnapshotUUID to the v1 volume snapshots get params +func (o *V1VolumeSnapshotsGetParams) WithVolumeSnapshotUUID(volumeSnapshotUUID string) *V1VolumeSnapshotsGetParams { + o.SetVolumeSnapshotUUID(volumeSnapshotUUID) + return o +} + +// SetVolumeSnapshotUUID adds the volumeSnapshotUuid to the v1 volume snapshots get params +func (o *V1VolumeSnapshotsGetParams) SetVolumeSnapshotUUID(volumeSnapshotUUID string) { + o.VolumeSnapshotUUID = volumeSnapshotUUID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1VolumeSnapshotsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param volume_snapshot_uuid + if err := r.SetPathParam("volume_snapshot_uuid", o.VolumeSnapshotUUID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/snapshots/v1_volume_snapshots_get_responses.go b/power/client/snapshots/v1_volume_snapshots_get_responses.go new file mode 100644 index 00000000..4402d278 --- /dev/null +++ b/power/client/snapshots/v1_volume_snapshots_get_responses.go @@ -0,0 +1,562 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package snapshots + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1VolumeSnapshotsGetReader is a Reader for the V1VolumeSnapshotsGet structure. +type V1VolumeSnapshotsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1VolumeSnapshotsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1VolumeSnapshotsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1VolumeSnapshotsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1VolumeSnapshotsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1VolumeSnapshotsGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1VolumeSnapshotsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1VolumeSnapshotsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 503: + result := NewV1VolumeSnapshotsGetServiceUnavailable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/volume-snapshots/{volume_snapshot_uuid}] v1.volume-snapshots.get", response, response.Code()) + } +} + +// NewV1VolumeSnapshotsGetOK creates a V1VolumeSnapshotsGetOK with default headers values +func NewV1VolumeSnapshotsGetOK() *V1VolumeSnapshotsGetOK { + return &V1VolumeSnapshotsGetOK{} +} + +/* +V1VolumeSnapshotsGetOK describes a response with status code 200, with default header values. + +OK +*/ +type V1VolumeSnapshotsGetOK struct { + Payload *models.SnapshotV1 +} + +// IsSuccess returns true when this v1 volume snapshots get o k response has a 2xx status code +func (o *V1VolumeSnapshotsGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 volume snapshots get o k response has a 3xx status code +func (o *V1VolumeSnapshotsGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots get o k response has a 4xx status code +func (o *V1VolumeSnapshotsGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 volume snapshots get o k response has a 5xx status code +func (o *V1VolumeSnapshotsGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 volume snapshots get o k response a status code equal to that given +func (o *V1VolumeSnapshotsGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 volume snapshots get o k response +func (o *V1VolumeSnapshotsGetOK) Code() int { + return 200 +} + +func (o *V1VolumeSnapshotsGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetOK %s", 200, payload) +} + +func (o *V1VolumeSnapshotsGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetOK %s", 200, payload) +} + +func (o *V1VolumeSnapshotsGetOK) GetPayload() *models.SnapshotV1 { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SnapshotV1) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1VolumeSnapshotsGetBadRequest creates a V1VolumeSnapshotsGetBadRequest with default headers values +func NewV1VolumeSnapshotsGetBadRequest() *V1VolumeSnapshotsGetBadRequest { + return &V1VolumeSnapshotsGetBadRequest{} +} + +/* +V1VolumeSnapshotsGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1VolumeSnapshotsGetBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots get bad request response has a 2xx status code +func (o *V1VolumeSnapshotsGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots get bad request response has a 3xx status code +func (o *V1VolumeSnapshotsGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots get bad request response has a 4xx status code +func (o *V1VolumeSnapshotsGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 volume snapshots get bad request response has a 5xx status code +func (o *V1VolumeSnapshotsGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 volume snapshots get bad request response a status code equal to that given +func (o *V1VolumeSnapshotsGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 volume snapshots get bad request response +func (o *V1VolumeSnapshotsGetBadRequest) Code() int { + return 400 +} + +func (o *V1VolumeSnapshotsGetBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetBadRequest %s", 400, payload) +} + +func (o *V1VolumeSnapshotsGetBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetBadRequest %s", 400, payload) +} + +func (o *V1VolumeSnapshotsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1VolumeSnapshotsGetUnauthorized creates a V1VolumeSnapshotsGetUnauthorized with default headers values +func NewV1VolumeSnapshotsGetUnauthorized() *V1VolumeSnapshotsGetUnauthorized { + return &V1VolumeSnapshotsGetUnauthorized{} +} + +/* +V1VolumeSnapshotsGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1VolumeSnapshotsGetUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots get unauthorized response has a 2xx status code +func (o *V1VolumeSnapshotsGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots get unauthorized response has a 3xx status code +func (o *V1VolumeSnapshotsGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots get unauthorized response has a 4xx status code +func (o *V1VolumeSnapshotsGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 volume snapshots get unauthorized response has a 5xx status code +func (o *V1VolumeSnapshotsGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 volume snapshots get unauthorized response a status code equal to that given +func (o *V1VolumeSnapshotsGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 volume snapshots get unauthorized response +func (o *V1VolumeSnapshotsGetUnauthorized) Code() int { + return 401 +} + +func (o *V1VolumeSnapshotsGetUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetUnauthorized %s", 401, payload) +} + +func (o *V1VolumeSnapshotsGetUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetUnauthorized %s", 401, payload) +} + +func (o *V1VolumeSnapshotsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1VolumeSnapshotsGetForbidden creates a V1VolumeSnapshotsGetForbidden with default headers values +func NewV1VolumeSnapshotsGetForbidden() *V1VolumeSnapshotsGetForbidden { + return &V1VolumeSnapshotsGetForbidden{} +} + +/* +V1VolumeSnapshotsGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1VolumeSnapshotsGetForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots get forbidden response has a 2xx status code +func (o *V1VolumeSnapshotsGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots get forbidden response has a 3xx status code +func (o *V1VolumeSnapshotsGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots get forbidden response has a 4xx status code +func (o *V1VolumeSnapshotsGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 volume snapshots get forbidden response has a 5xx status code +func (o *V1VolumeSnapshotsGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 volume snapshots get forbidden response a status code equal to that given +func (o *V1VolumeSnapshotsGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 volume snapshots get forbidden response +func (o *V1VolumeSnapshotsGetForbidden) Code() int { + return 403 +} + +func (o *V1VolumeSnapshotsGetForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetForbidden %s", 403, payload) +} + +func (o *V1VolumeSnapshotsGetForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetForbidden %s", 403, payload) +} + +func (o *V1VolumeSnapshotsGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1VolumeSnapshotsGetNotFound creates a V1VolumeSnapshotsGetNotFound with default headers values +func NewV1VolumeSnapshotsGetNotFound() *V1VolumeSnapshotsGetNotFound { + return &V1VolumeSnapshotsGetNotFound{} +} + +/* +V1VolumeSnapshotsGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1VolumeSnapshotsGetNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots get not found response has a 2xx status code +func (o *V1VolumeSnapshotsGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots get not found response has a 3xx status code +func (o *V1VolumeSnapshotsGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots get not found response has a 4xx status code +func (o *V1VolumeSnapshotsGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 volume snapshots get not found response has a 5xx status code +func (o *V1VolumeSnapshotsGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 volume snapshots get not found response a status code equal to that given +func (o *V1VolumeSnapshotsGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 volume snapshots get not found response +func (o *V1VolumeSnapshotsGetNotFound) Code() int { + return 404 +} + +func (o *V1VolumeSnapshotsGetNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetNotFound %s", 404, payload) +} + +func (o *V1VolumeSnapshotsGetNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetNotFound %s", 404, payload) +} + +func (o *V1VolumeSnapshotsGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1VolumeSnapshotsGetInternalServerError creates a V1VolumeSnapshotsGetInternalServerError with default headers values +func NewV1VolumeSnapshotsGetInternalServerError() *V1VolumeSnapshotsGetInternalServerError { + return &V1VolumeSnapshotsGetInternalServerError{} +} + +/* +V1VolumeSnapshotsGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1VolumeSnapshotsGetInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots get internal server error response has a 2xx status code +func (o *V1VolumeSnapshotsGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots get internal server error response has a 3xx status code +func (o *V1VolumeSnapshotsGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots get internal server error response has a 4xx status code +func (o *V1VolumeSnapshotsGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 volume snapshots get internal server error response has a 5xx status code +func (o *V1VolumeSnapshotsGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 volume snapshots get internal server error response a status code equal to that given +func (o *V1VolumeSnapshotsGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 volume snapshots get internal server error response +func (o *V1VolumeSnapshotsGetInternalServerError) Code() int { + return 500 +} + +func (o *V1VolumeSnapshotsGetInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetInternalServerError %s", 500, payload) +} + +func (o *V1VolumeSnapshotsGetInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetInternalServerError %s", 500, payload) +} + +func (o *V1VolumeSnapshotsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1VolumeSnapshotsGetServiceUnavailable creates a V1VolumeSnapshotsGetServiceUnavailable with default headers values +func NewV1VolumeSnapshotsGetServiceUnavailable() *V1VolumeSnapshotsGetServiceUnavailable { + return &V1VolumeSnapshotsGetServiceUnavailable{} +} + +/* +V1VolumeSnapshotsGetServiceUnavailable describes a response with status code 503, with default header values. + +Service Unavailable +*/ +type V1VolumeSnapshotsGetServiceUnavailable struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots get service unavailable response has a 2xx status code +func (o *V1VolumeSnapshotsGetServiceUnavailable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots get service unavailable response has a 3xx status code +func (o *V1VolumeSnapshotsGetServiceUnavailable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots get service unavailable response has a 4xx status code +func (o *V1VolumeSnapshotsGetServiceUnavailable) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 volume snapshots get service unavailable response has a 5xx status code +func (o *V1VolumeSnapshotsGetServiceUnavailable) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 volume snapshots get service unavailable response a status code equal to that given +func (o *V1VolumeSnapshotsGetServiceUnavailable) IsCode(code int) bool { + return code == 503 +} + +// Code gets the status code for the v1 volume snapshots get service unavailable response +func (o *V1VolumeSnapshotsGetServiceUnavailable) Code() int { + return 503 +} + +func (o *V1VolumeSnapshotsGetServiceUnavailable) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetServiceUnavailable %s", 503, payload) +} + +func (o *V1VolumeSnapshotsGetServiceUnavailable) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetServiceUnavailable %s", 503, payload) +} + +func (o *V1VolumeSnapshotsGetServiceUnavailable) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetServiceUnavailable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/snapshots/v1_volume_snapshots_getall_parameters.go b/power/client/snapshots/v1_volume_snapshots_getall_parameters.go new file mode 100644 index 00000000..5b96fcd1 --- /dev/null +++ b/power/client/snapshots/v1_volume_snapshots_getall_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package snapshots + +// 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" +) + +// NewV1VolumeSnapshotsGetallParams creates a new V1VolumeSnapshotsGetallParams 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 NewV1VolumeSnapshotsGetallParams() *V1VolumeSnapshotsGetallParams { + return &V1VolumeSnapshotsGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1VolumeSnapshotsGetallParamsWithTimeout creates a new V1VolumeSnapshotsGetallParams object +// with the ability to set a timeout on a request. +func NewV1VolumeSnapshotsGetallParamsWithTimeout(timeout time.Duration) *V1VolumeSnapshotsGetallParams { + return &V1VolumeSnapshotsGetallParams{ + timeout: timeout, + } +} + +// NewV1VolumeSnapshotsGetallParamsWithContext creates a new V1VolumeSnapshotsGetallParams object +// with the ability to set a context for a request. +func NewV1VolumeSnapshotsGetallParamsWithContext(ctx context.Context) *V1VolumeSnapshotsGetallParams { + return &V1VolumeSnapshotsGetallParams{ + Context: ctx, + } +} + +// NewV1VolumeSnapshotsGetallParamsWithHTTPClient creates a new V1VolumeSnapshotsGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1VolumeSnapshotsGetallParamsWithHTTPClient(client *http.Client) *V1VolumeSnapshotsGetallParams { + return &V1VolumeSnapshotsGetallParams{ + HTTPClient: client, + } +} + +/* +V1VolumeSnapshotsGetallParams contains all the parameters to send to the API endpoint + + for the v1 volume snapshots getall operation. + + Typically these are written to a http.Request. +*/ +type V1VolumeSnapshotsGetallParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 volume snapshots getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1VolumeSnapshotsGetallParams) WithDefaults() *V1VolumeSnapshotsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 volume snapshots getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1VolumeSnapshotsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 volume snapshots getall params +func (o *V1VolumeSnapshotsGetallParams) WithTimeout(timeout time.Duration) *V1VolumeSnapshotsGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 volume snapshots getall params +func (o *V1VolumeSnapshotsGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 volume snapshots getall params +func (o *V1VolumeSnapshotsGetallParams) WithContext(ctx context.Context) *V1VolumeSnapshotsGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 volume snapshots getall params +func (o *V1VolumeSnapshotsGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 volume snapshots getall params +func (o *V1VolumeSnapshotsGetallParams) WithHTTPClient(client *http.Client) *V1VolumeSnapshotsGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 volume snapshots getall params +func (o *V1VolumeSnapshotsGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *V1VolumeSnapshotsGetallParams) 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/power/client/snapshots/v1_volume_snapshots_getall_responses.go b/power/client/snapshots/v1_volume_snapshots_getall_responses.go new file mode 100644 index 00000000..525835e8 --- /dev/null +++ b/power/client/snapshots/v1_volume_snapshots_getall_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package snapshots + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1VolumeSnapshotsGetallReader is a Reader for the V1VolumeSnapshotsGetall structure. +type V1VolumeSnapshotsGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1VolumeSnapshotsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1VolumeSnapshotsGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewV1VolumeSnapshotsGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1VolumeSnapshotsGetallForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1VolumeSnapshotsGetallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1VolumeSnapshotsGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 503: + result := NewV1VolumeSnapshotsGetallServiceUnavailable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/volume-snapshots] v1.volume-snapshots.getall", response, response.Code()) + } +} + +// NewV1VolumeSnapshotsGetallOK creates a V1VolumeSnapshotsGetallOK with default headers values +func NewV1VolumeSnapshotsGetallOK() *V1VolumeSnapshotsGetallOK { + return &V1VolumeSnapshotsGetallOK{} +} + +/* +V1VolumeSnapshotsGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type V1VolumeSnapshotsGetallOK struct { + Payload *models.VolumeSnapshotList +} + +// IsSuccess returns true when this v1 volume snapshots getall o k response has a 2xx status code +func (o *V1VolumeSnapshotsGetallOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 volume snapshots getall o k response has a 3xx status code +func (o *V1VolumeSnapshotsGetallOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots getall o k response has a 4xx status code +func (o *V1VolumeSnapshotsGetallOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 volume snapshots getall o k response has a 5xx status code +func (o *V1VolumeSnapshotsGetallOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 volume snapshots getall o k response a status code equal to that given +func (o *V1VolumeSnapshotsGetallOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 volume snapshots getall o k response +func (o *V1VolumeSnapshotsGetallOK) Code() int { + return 200 +} + +func (o *V1VolumeSnapshotsGetallOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallOK %s", 200, payload) +} + +func (o *V1VolumeSnapshotsGetallOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallOK %s", 200, payload) +} + +func (o *V1VolumeSnapshotsGetallOK) GetPayload() *models.VolumeSnapshotList { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.VolumeSnapshotList) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1VolumeSnapshotsGetallUnauthorized creates a V1VolumeSnapshotsGetallUnauthorized with default headers values +func NewV1VolumeSnapshotsGetallUnauthorized() *V1VolumeSnapshotsGetallUnauthorized { + return &V1VolumeSnapshotsGetallUnauthorized{} +} + +/* +V1VolumeSnapshotsGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1VolumeSnapshotsGetallUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots getall unauthorized response has a 2xx status code +func (o *V1VolumeSnapshotsGetallUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots getall unauthorized response has a 3xx status code +func (o *V1VolumeSnapshotsGetallUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots getall unauthorized response has a 4xx status code +func (o *V1VolumeSnapshotsGetallUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 volume snapshots getall unauthorized response has a 5xx status code +func (o *V1VolumeSnapshotsGetallUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 volume snapshots getall unauthorized response a status code equal to that given +func (o *V1VolumeSnapshotsGetallUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 volume snapshots getall unauthorized response +func (o *V1VolumeSnapshotsGetallUnauthorized) Code() int { + return 401 +} + +func (o *V1VolumeSnapshotsGetallUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallUnauthorized %s", 401, payload) +} + +func (o *V1VolumeSnapshotsGetallUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallUnauthorized %s", 401, payload) +} + +func (o *V1VolumeSnapshotsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1VolumeSnapshotsGetallForbidden creates a V1VolumeSnapshotsGetallForbidden with default headers values +func NewV1VolumeSnapshotsGetallForbidden() *V1VolumeSnapshotsGetallForbidden { + return &V1VolumeSnapshotsGetallForbidden{} +} + +/* +V1VolumeSnapshotsGetallForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1VolumeSnapshotsGetallForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots getall forbidden response has a 2xx status code +func (o *V1VolumeSnapshotsGetallForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots getall forbidden response has a 3xx status code +func (o *V1VolumeSnapshotsGetallForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots getall forbidden response has a 4xx status code +func (o *V1VolumeSnapshotsGetallForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 volume snapshots getall forbidden response has a 5xx status code +func (o *V1VolumeSnapshotsGetallForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 volume snapshots getall forbidden response a status code equal to that given +func (o *V1VolumeSnapshotsGetallForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 volume snapshots getall forbidden response +func (o *V1VolumeSnapshotsGetallForbidden) Code() int { + return 403 +} + +func (o *V1VolumeSnapshotsGetallForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallForbidden %s", 403, payload) +} + +func (o *V1VolumeSnapshotsGetallForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallForbidden %s", 403, payload) +} + +func (o *V1VolumeSnapshotsGetallForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetallForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1VolumeSnapshotsGetallNotFound creates a V1VolumeSnapshotsGetallNotFound with default headers values +func NewV1VolumeSnapshotsGetallNotFound() *V1VolumeSnapshotsGetallNotFound { + return &V1VolumeSnapshotsGetallNotFound{} +} + +/* +V1VolumeSnapshotsGetallNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1VolumeSnapshotsGetallNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots getall not found response has a 2xx status code +func (o *V1VolumeSnapshotsGetallNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots getall not found response has a 3xx status code +func (o *V1VolumeSnapshotsGetallNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots getall not found response has a 4xx status code +func (o *V1VolumeSnapshotsGetallNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 volume snapshots getall not found response has a 5xx status code +func (o *V1VolumeSnapshotsGetallNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 volume snapshots getall not found response a status code equal to that given +func (o *V1VolumeSnapshotsGetallNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 volume snapshots getall not found response +func (o *V1VolumeSnapshotsGetallNotFound) Code() int { + return 404 +} + +func (o *V1VolumeSnapshotsGetallNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallNotFound %s", 404, payload) +} + +func (o *V1VolumeSnapshotsGetallNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallNotFound %s", 404, payload) +} + +func (o *V1VolumeSnapshotsGetallNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetallNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1VolumeSnapshotsGetallInternalServerError creates a V1VolumeSnapshotsGetallInternalServerError with default headers values +func NewV1VolumeSnapshotsGetallInternalServerError() *V1VolumeSnapshotsGetallInternalServerError { + return &V1VolumeSnapshotsGetallInternalServerError{} +} + +/* +V1VolumeSnapshotsGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1VolumeSnapshotsGetallInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots getall internal server error response has a 2xx status code +func (o *V1VolumeSnapshotsGetallInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots getall internal server error response has a 3xx status code +func (o *V1VolumeSnapshotsGetallInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots getall internal server error response has a 4xx status code +func (o *V1VolumeSnapshotsGetallInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 volume snapshots getall internal server error response has a 5xx status code +func (o *V1VolumeSnapshotsGetallInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 volume snapshots getall internal server error response a status code equal to that given +func (o *V1VolumeSnapshotsGetallInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 volume snapshots getall internal server error response +func (o *V1VolumeSnapshotsGetallInternalServerError) Code() int { + return 500 +} + +func (o *V1VolumeSnapshotsGetallInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallInternalServerError %s", 500, payload) +} + +func (o *V1VolumeSnapshotsGetallInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallInternalServerError %s", 500, payload) +} + +func (o *V1VolumeSnapshotsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1VolumeSnapshotsGetallServiceUnavailable creates a V1VolumeSnapshotsGetallServiceUnavailable with default headers values +func NewV1VolumeSnapshotsGetallServiceUnavailable() *V1VolumeSnapshotsGetallServiceUnavailable { + return &V1VolumeSnapshotsGetallServiceUnavailable{} +} + +/* +V1VolumeSnapshotsGetallServiceUnavailable describes a response with status code 503, with default header values. + +Service Unavailable +*/ +type V1VolumeSnapshotsGetallServiceUnavailable struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots getall service unavailable response has a 2xx status code +func (o *V1VolumeSnapshotsGetallServiceUnavailable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots getall service unavailable response has a 3xx status code +func (o *V1VolumeSnapshotsGetallServiceUnavailable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots getall service unavailable response has a 4xx status code +func (o *V1VolumeSnapshotsGetallServiceUnavailable) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 volume snapshots getall service unavailable response has a 5xx status code +func (o *V1VolumeSnapshotsGetallServiceUnavailable) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 volume snapshots getall service unavailable response a status code equal to that given +func (o *V1VolumeSnapshotsGetallServiceUnavailable) IsCode(code int) bool { + return code == 503 +} + +// Code gets the status code for the v1 volume snapshots getall service unavailable response +func (o *V1VolumeSnapshotsGetallServiceUnavailable) Code() int { + return 503 +} + +func (o *V1VolumeSnapshotsGetallServiceUnavailable) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallServiceUnavailable %s", 503, payload) +} + +func (o *V1VolumeSnapshotsGetallServiceUnavailable) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallServiceUnavailable %s", 503, payload) +} + +func (o *V1VolumeSnapshotsGetallServiceUnavailable) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetallServiceUnavailable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/models/snapshot_list.go b/power/models/snapshot_list.go index a1e6fd10..ee6a7d7b 100644 --- a/power/models/snapshot_list.go +++ b/power/models/snapshot_list.go @@ -20,7 +20,7 @@ import ( // swagger:model SnapshotList type SnapshotList struct { - // The list of snapshots. + // The list of volume snapshots. // Required: true Snapshots []*SnapshotV1 `json:"snapshots"` } diff --git a/power/models/snapshot_v1.go b/power/models/snapshot_v1.go index 674c2ef2..570c3a4f 100644 --- a/power/models/snapshot_v1.go +++ b/power/models/snapshot_v1.go @@ -19,30 +19,30 @@ import ( // swagger:model SnapshotV1 type SnapshotV1 struct { - // The date and time when the snapshot was created. + // The date and time when the volume snapshot was created. // Format: date-time CreationDate strfmt.DateTime `json:"creationDate,omitempty"` // crn Crn CRN `json:"crn,omitempty"` - // The snapshot UUID. + // The volume snapshot UUID. // Required: true ID *string `json:"id"` - // The snapshot name. + // The volume snapshot name. // Required: true Name *string `json:"name"` - // The size of the snapshot, in gibibytes (GiB). + // The size of the volume snapshot, in gibibytes (GiB). // Required: true Size *float64 `json:"size"` - // The status for the snapshot. + // The status for the volume snapshot. // Required: true Status *string `json:"status"` - // The date and time when the snapshot was last updated. + // The date and time when the volume snapshot was last updated. // Format: date-time UpdatedDate strfmt.DateTime `json:"updatedDate,omitempty"` diff --git a/power/models/volume_snapshot_list.go b/power/models/volume_snapshot_list.go new file mode 100644 index 00000000..9190cd33 --- /dev/null +++ b/power/models/volume_snapshot_list.go @@ -0,0 +1,121 @@ +// 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" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// VolumeSnapshotList volume snapshot list +// +// swagger:model VolumeSnapshotList +type VolumeSnapshotList struct { + + // The list of volume snapshots. + VolumeSnapshots []*SnapshotV1 `json:"volumeSnapshots"` +} + +// Validate validates this volume snapshot list +func (m *VolumeSnapshotList) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVolumeSnapshots(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumeSnapshotList) validateVolumeSnapshots(formats strfmt.Registry) error { + if swag.IsZero(m.VolumeSnapshots) { // not required + return nil + } + + for i := 0; i < len(m.VolumeSnapshots); i++ { + if swag.IsZero(m.VolumeSnapshots[i]) { // not required + continue + } + + if m.VolumeSnapshots[i] != nil { + if err := m.VolumeSnapshots[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("volumeSnapshots" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volumeSnapshots" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this volume snapshot list based on the context it is used +func (m *VolumeSnapshotList) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVolumeSnapshots(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumeSnapshotList) contextValidateVolumeSnapshots(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.VolumeSnapshots); i++ { + + if m.VolumeSnapshots[i] != nil { + + if swag.IsZero(m.VolumeSnapshots[i]) { // not required + return nil + } + + if err := m.VolumeSnapshots[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("volumeSnapshots" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volumeSnapshots" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *VolumeSnapshotList) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VolumeSnapshotList) UnmarshalBinary(b []byte) error { + var res VolumeSnapshotList + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +}