diff --git a/clients/instance/ibm-pi-snapshot.go b/clients/instance/ibm-pi-snapshot.go index 676c9647..f1560d91 100644 --- a/clients/instance/ibm-pi-snapshot.go +++ b/clients/instance/ibm-pi-snapshot.go @@ -8,6 +8,8 @@ import ( "github.com/IBM-Cloud/power-go-client/ibmpisession" "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances" "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots" + "github.com/IBM-Cloud/power-go-client/power/client/snapshots" + "github.com/IBM-Cloud/power-go-client/power/models" ) @@ -96,3 +98,59 @@ func (f *IBMPISnapshotClient) Create(instanceID, snapshotID, restoreFailAction s } return resp.Payload, nil } + +// Get a Volume SnapshotV1 +func (f *IBMPISnapshotClient) V1VolumeSnapshotsGet(id string) (*models.SnapshotV1, error) { + params := snapshots.NewV1VolumeSnapshotsGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithVolumeSnapshotUUID(id) + resp, err := f.session.Power.Snapshots.V1VolumeSnapshotsGet(params, f.session.AuthInfo(f.cloudInstanceID)) + + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get volume snapshot %s: %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get PI Snapshot %s", id) + } + return resp.Payload, nil +} + +// Get Volume All SnapshotsV1 +func (f *IBMPISnapshotClient) V1VolumeSnapshotsGetall() (*models.VolumeSnapshotList, error) { + params := snapshots.NewV1VolumeSnapshotsGetallParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut) + resp, err := f.session.Power.Snapshots.V1VolumeSnapshotsGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get all volume snapshots: %w", err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get all volume Snapshots") + } + return resp.Payload, nil +} + +// Deprecated Get a SnapshotV1 +func (f *IBMPISnapshotClient) V1SnapshotsGet(id string) (*models.SnapshotV1, error) { + params := snapshots.NewV1SnapshotsGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithSnapshotID(id) + resp, err := f.session.Power.Snapshots.V1SnapshotsGet(params, f.session.AuthInfo(f.cloudInstanceID)) + + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get PI Snapshot %s: %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get PI Snapshot %s", id) + } + return resp.Payload, nil +} + +// Deprecated Get All SnapshotsV1 +func (f *IBMPISnapshotClient) V1SnapshotsGetall() (*models.SnapshotList, error) { + params := snapshots.NewV1SnapshotsGetallParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut) + resp, err := f.session.Power.Snapshots.V1SnapshotsGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get all PI Snapshots: %w", err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get all PI Snapshots") + } + return resp.Payload, nil +} diff --git a/examples/snapshot/main.go b/examples/snapshot/main.go index db5ead3d..55403a16 100644 --- a/examples/snapshot/main.go +++ b/examples/snapshot/main.go @@ -24,6 +24,7 @@ func main() { instance_id := " < INSTANCE ID > " snap_name := " < SNAPSHOT NAME > " description := " < DESCRIPTION > " + snapshot_id := " < SNAPSHOT ID > " authenticator := &core.BearerTokenAuthenticator{ BearerToken: token, @@ -81,4 +82,16 @@ func main() { } log.Printf("***************[4]****************** %+v \n", err) + // ***************[] SnapshotsV1 []****************** + getAllSnapV1Resp, err := powerSnapClient.V1SnapshotsGetall() + if err != nil { + log.Fatal(err) + } + log.Printf("***************[5]****************** %+v \n", getAllSnapV1Resp) + + getSnapV1Resp, err := powerSnapClient.V1SnapshotsGet(snapshot_id) + if err != nil { + log.Fatal(err) + } + log.Printf("***************[6]****************** %+v \n", getSnapV1Resp) } diff --git a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_responses.go b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_responses.go index 485b02fb..edd642b6 100644 --- a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_responses.go +++ b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_responses.go @@ -66,6 +66,12 @@ func (o *PcloudCloudconnectionsPostReader) ReadResponse(response runtime.ClientR return nil, err } return nil, result + case 405: + result := NewPcloudCloudconnectionsPostMethodNotAllowed() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result case 408: result := NewPcloudCloudconnectionsPostRequestTimeout() if err := result.readResponse(response, consumer, o.formats); err != nil { @@ -597,6 +603,76 @@ func (o *PcloudCloudconnectionsPostNotFound) readResponse(response runtime.Clien return nil } +// NewPcloudCloudconnectionsPostMethodNotAllowed creates a PcloudCloudconnectionsPostMethodNotAllowed with default headers values +func NewPcloudCloudconnectionsPostMethodNotAllowed() *PcloudCloudconnectionsPostMethodNotAllowed { + return &PcloudCloudconnectionsPostMethodNotAllowed{} +} + +/* +PcloudCloudconnectionsPostMethodNotAllowed describes a response with status code 405, with default header values. + +Method Not Allowed +*/ +type PcloudCloudconnectionsPostMethodNotAllowed struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud cloudconnections post method not allowed response has a 2xx status code +func (o *PcloudCloudconnectionsPostMethodNotAllowed) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud cloudconnections post method not allowed response has a 3xx status code +func (o *PcloudCloudconnectionsPostMethodNotAllowed) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud cloudconnections post method not allowed response has a 4xx status code +func (o *PcloudCloudconnectionsPostMethodNotAllowed) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud cloudconnections post method not allowed response has a 5xx status code +func (o *PcloudCloudconnectionsPostMethodNotAllowed) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud cloudconnections post method not allowed response a status code equal to that given +func (o *PcloudCloudconnectionsPostMethodNotAllowed) IsCode(code int) bool { + return code == 405 +} + +// Code gets the status code for the pcloud cloudconnections post method not allowed response +func (o *PcloudCloudconnectionsPostMethodNotAllowed) Code() int { + return 405 +} + +func (o *PcloudCloudconnectionsPostMethodNotAllowed) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsPostMethodNotAllowed %s", 405, payload) +} + +func (o *PcloudCloudconnectionsPostMethodNotAllowed) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsPostMethodNotAllowed %s", 405, payload) +} + +func (o *PcloudCloudconnectionsPostMethodNotAllowed) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsPostMethodNotAllowed) 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 +} + // NewPcloudCloudconnectionsPostRequestTimeout creates a PcloudCloudconnectionsPostRequestTimeout with default headers values func NewPcloudCloudconnectionsPostRequestTimeout() *PcloudCloudconnectionsPostRequestTimeout { return &PcloudCloudconnectionsPostRequestTimeout{} diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_responses.go index c1c3e716..60397da2 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_responses.go @@ -60,6 +60,12 @@ func (o *PcloudPvminstancesClonePostReader) ReadResponse(response runtime.Client return nil, err } return nil, result + case 410: + result := NewPcloudPvminstancesClonePostGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result case 422: result := NewPcloudPvminstancesClonePostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { @@ -497,6 +503,76 @@ func (o *PcloudPvminstancesClonePostConflict) readResponse(response runtime.Clie return nil } +// NewPcloudPvminstancesClonePostGone creates a PcloudPvminstancesClonePostGone with default headers values +func NewPcloudPvminstancesClonePostGone() *PcloudPvminstancesClonePostGone { + return &PcloudPvminstancesClonePostGone{} +} + +/* +PcloudPvminstancesClonePostGone describes a response with status code 410, with default header values. + +Gone +*/ +type PcloudPvminstancesClonePostGone struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances clone post gone response has a 2xx status code +func (o *PcloudPvminstancesClonePostGone) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances clone post gone response has a 3xx status code +func (o *PcloudPvminstancesClonePostGone) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances clone post gone response has a 4xx status code +func (o *PcloudPvminstancesClonePostGone) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud pvminstances clone post gone response has a 5xx status code +func (o *PcloudPvminstancesClonePostGone) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances clone post gone response a status code equal to that given +func (o *PcloudPvminstancesClonePostGone) IsCode(code int) bool { + return code == 410 +} + +// Code gets the status code for the pcloud pvminstances clone post gone response +func (o *PcloudPvminstancesClonePostGone) Code() int { + return 410 +} + +func (o *PcloudPvminstancesClonePostGone) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/clone][%d] pcloudPvminstancesClonePostGone %s", 410, payload) +} + +func (o *PcloudPvminstancesClonePostGone) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/clone][%d] pcloudPvminstancesClonePostGone %s", 410, payload) +} + +func (o *PcloudPvminstancesClonePostGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesClonePostGone) 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 +} + // NewPcloudPvminstancesClonePostUnprocessableEntity creates a PcloudPvminstancesClonePostUnprocessableEntity with default headers values func NewPcloudPvminstancesClonePostUnprocessableEntity() *PcloudPvminstancesClonePostUnprocessableEntity { return &PcloudPvminstancesClonePostUnprocessableEntity{} diff --git a/power/client/p_cloud_volumes/p_cloud_volumes_client.go b/power/client/p_cloud_volumes/p_cloud_volumes_client.go index e2bc42c7..219bd859 100644 --- a/power/client/p_cloud_volumes/p_cloud_volumes_client.go +++ b/power/client/p_cloud_volumes/p_cloud_volumes_client.go @@ -94,6 +94,8 @@ type ClientService interface { PcloudV2VolumesDelete(params *PcloudV2VolumesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesDeleteAccepted, *PcloudV2VolumesDeletePartialContent, error) + PcloudV2VolumesGetall(params *PcloudV2VolumesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesGetallOK, error) + PcloudV2VolumesPost(params *PcloudV2VolumesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesPostCreated, error) PcloudV2VolumescloneCancelPost(params *PcloudV2VolumescloneCancelPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneCancelPostAccepted, error) @@ -869,6 +871,45 @@ func (a *Client) PcloudV2VolumesDelete(params *PcloudV2VolumesDeleteParams, auth panic(msg) } +/* +PcloudV2VolumesGetall lists specified volumes for this cloud instance +*/ +func (a *Client) PcloudV2VolumesGetall(params *PcloudV2VolumesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudV2VolumesGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.v2.volumes.getall", + Method: "GET", + PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudV2VolumesGetallReader{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.(*PcloudV2VolumesGetallOK) + 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 pcloud.v2.volumes.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* PcloudV2VolumesPost creates multiple data volumes from a single definition */ diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumes_getall_parameters.go b/power/client/p_cloud_volumes/pcloud_v2_volumes_getall_parameters.go new file mode 100644 index 00000000..4c668aff --- /dev/null +++ b/power/client/p_cloud_volumes/pcloud_v2_volumes_getall_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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/IBM-Cloud/power-go-client/power/models" +) + +// NewPcloudV2VolumesGetallParams creates a new PcloudV2VolumesGetallParams 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 NewPcloudV2VolumesGetallParams() *PcloudV2VolumesGetallParams { + return &PcloudV2VolumesGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudV2VolumesGetallParamsWithTimeout creates a new PcloudV2VolumesGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudV2VolumesGetallParamsWithTimeout(timeout time.Duration) *PcloudV2VolumesGetallParams { + return &PcloudV2VolumesGetallParams{ + timeout: timeout, + } +} + +// NewPcloudV2VolumesGetallParamsWithContext creates a new PcloudV2VolumesGetallParams object +// with the ability to set a context for a request. +func NewPcloudV2VolumesGetallParamsWithContext(ctx context.Context) *PcloudV2VolumesGetallParams { + return &PcloudV2VolumesGetallParams{ + Context: ctx, + } +} + +// NewPcloudV2VolumesGetallParamsWithHTTPClient creates a new PcloudV2VolumesGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudV2VolumesGetallParamsWithHTTPClient(client *http.Client) *PcloudV2VolumesGetallParams { + return &PcloudV2VolumesGetallParams{ + HTTPClient: client, + } +} + +/* +PcloudV2VolumesGetallParams contains all the parameters to send to the API endpoint + + for the pcloud v2 volumes getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudV2VolumesGetallParams struct { + + /* Body. + + Parameters for fetching list of specified volumes + */ + Body *models.GetBulkVolume + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud v2 volumes getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumesGetallParams) WithDefaults() *PcloudV2VolumesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumes getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud v2 volumes getall params +func (o *PcloudV2VolumesGetallParams) WithTimeout(timeout time.Duration) *PcloudV2VolumesGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud v2 volumes getall params +func (o *PcloudV2VolumesGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud v2 volumes getall params +func (o *PcloudV2VolumesGetallParams) WithContext(ctx context.Context) *PcloudV2VolumesGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud v2 volumes getall params +func (o *PcloudV2VolumesGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud v2 volumes getall params +func (o *PcloudV2VolumesGetallParams) WithHTTPClient(client *http.Client) *PcloudV2VolumesGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud v2 volumes getall params +func (o *PcloudV2VolumesGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud v2 volumes getall params +func (o *PcloudV2VolumesGetallParams) WithBody(body *models.GetBulkVolume) *PcloudV2VolumesGetallParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud v2 volumes getall params +func (o *PcloudV2VolumesGetallParams) SetBody(body *models.GetBulkVolume) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud v2 volumes getall params +func (o *PcloudV2VolumesGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudV2VolumesGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud v2 volumes getall params +func (o *PcloudV2VolumesGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudV2VolumesGetallParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumes_getall_responses.go b/power/client/p_cloud_volumes/pcloud_v2_volumes_getall_responses.go new file mode 100644 index 00000000..8d2120b5 --- /dev/null +++ b/power/client/p_cloud_volumes/pcloud_v2_volumes_getall_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// PcloudV2VolumesGetallReader is a Reader for the PcloudV2VolumesGetall structure. +type PcloudV2VolumesGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudV2VolumesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudV2VolumesGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudV2VolumesGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudV2VolumesGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudV2VolumesGetallForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudV2VolumesGetallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudV2VolumesGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes] pcloud.v2.volumes.getall", response, response.Code()) + } +} + +// NewPcloudV2VolumesGetallOK creates a PcloudV2VolumesGetallOK with default headers values +func NewPcloudV2VolumesGetallOK() *PcloudV2VolumesGetallOK { + return &PcloudV2VolumesGetallOK{} +} + +/* +PcloudV2VolumesGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudV2VolumesGetallOK struct { + Payload *models.Volumes +} + +// IsSuccess returns true when this pcloud v2 volumes getall o k response has a 2xx status code +func (o *PcloudV2VolumesGetallOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this pcloud v2 volumes getall o k response has a 3xx status code +func (o *PcloudV2VolumesGetallOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud v2 volumes getall o k response has a 4xx status code +func (o *PcloudV2VolumesGetallOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud v2 volumes getall o k response has a 5xx status code +func (o *PcloudV2VolumesGetallOK) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud v2 volumes getall o k response a status code equal to that given +func (o *PcloudV2VolumesGetallOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the pcloud v2 volumes getall o k response +func (o *PcloudV2VolumesGetallOK) Code() int { + return 200 +} + +func (o *PcloudV2VolumesGetallOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallOK %s", 200, payload) +} + +func (o *PcloudV2VolumesGetallOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallOK %s", 200, payload) +} + +func (o *PcloudV2VolumesGetallOK) GetPayload() *models.Volumes { + return o.Payload +} + +func (o *PcloudV2VolumesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Volumes) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudV2VolumesGetallBadRequest creates a PcloudV2VolumesGetallBadRequest with default headers values +func NewPcloudV2VolumesGetallBadRequest() *PcloudV2VolumesGetallBadRequest { + return &PcloudV2VolumesGetallBadRequest{} +} + +/* +PcloudV2VolumesGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudV2VolumesGetallBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud v2 volumes getall bad request response has a 2xx status code +func (o *PcloudV2VolumesGetallBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud v2 volumes getall bad request response has a 3xx status code +func (o *PcloudV2VolumesGetallBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud v2 volumes getall bad request response has a 4xx status code +func (o *PcloudV2VolumesGetallBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud v2 volumes getall bad request response has a 5xx status code +func (o *PcloudV2VolumesGetallBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud v2 volumes getall bad request response a status code equal to that given +func (o *PcloudV2VolumesGetallBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the pcloud v2 volumes getall bad request response +func (o *PcloudV2VolumesGetallBadRequest) Code() int { + return 400 +} + +func (o *PcloudV2VolumesGetallBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallBadRequest %s", 400, payload) +} + +func (o *PcloudV2VolumesGetallBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallBadRequest %s", 400, payload) +} + +func (o *PcloudV2VolumesGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesGetallBadRequest) 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 +} + +// NewPcloudV2VolumesGetallUnauthorized creates a PcloudV2VolumesGetallUnauthorized with default headers values +func NewPcloudV2VolumesGetallUnauthorized() *PcloudV2VolumesGetallUnauthorized { + return &PcloudV2VolumesGetallUnauthorized{} +} + +/* +PcloudV2VolumesGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudV2VolumesGetallUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud v2 volumes getall unauthorized response has a 2xx status code +func (o *PcloudV2VolumesGetallUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud v2 volumes getall unauthorized response has a 3xx status code +func (o *PcloudV2VolumesGetallUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud v2 volumes getall unauthorized response has a 4xx status code +func (o *PcloudV2VolumesGetallUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud v2 volumes getall unauthorized response has a 5xx status code +func (o *PcloudV2VolumesGetallUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud v2 volumes getall unauthorized response a status code equal to that given +func (o *PcloudV2VolumesGetallUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the pcloud v2 volumes getall unauthorized response +func (o *PcloudV2VolumesGetallUnauthorized) Code() int { + return 401 +} + +func (o *PcloudV2VolumesGetallUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallUnauthorized %s", 401, payload) +} + +func (o *PcloudV2VolumesGetallUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallUnauthorized %s", 401, payload) +} + +func (o *PcloudV2VolumesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesGetallUnauthorized) 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 +} + +// NewPcloudV2VolumesGetallForbidden creates a PcloudV2VolumesGetallForbidden with default headers values +func NewPcloudV2VolumesGetallForbidden() *PcloudV2VolumesGetallForbidden { + return &PcloudV2VolumesGetallForbidden{} +} + +/* +PcloudV2VolumesGetallForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudV2VolumesGetallForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud v2 volumes getall forbidden response has a 2xx status code +func (o *PcloudV2VolumesGetallForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud v2 volumes getall forbidden response has a 3xx status code +func (o *PcloudV2VolumesGetallForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud v2 volumes getall forbidden response has a 4xx status code +func (o *PcloudV2VolumesGetallForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud v2 volumes getall forbidden response has a 5xx status code +func (o *PcloudV2VolumesGetallForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud v2 volumes getall forbidden response a status code equal to that given +func (o *PcloudV2VolumesGetallForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the pcloud v2 volumes getall forbidden response +func (o *PcloudV2VolumesGetallForbidden) Code() int { + return 403 +} + +func (o *PcloudV2VolumesGetallForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallForbidden %s", 403, payload) +} + +func (o *PcloudV2VolumesGetallForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallForbidden %s", 403, payload) +} + +func (o *PcloudV2VolumesGetallForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesGetallForbidden) 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 +} + +// NewPcloudV2VolumesGetallNotFound creates a PcloudV2VolumesGetallNotFound with default headers values +func NewPcloudV2VolumesGetallNotFound() *PcloudV2VolumesGetallNotFound { + return &PcloudV2VolumesGetallNotFound{} +} + +/* +PcloudV2VolumesGetallNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudV2VolumesGetallNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud v2 volumes getall not found response has a 2xx status code +func (o *PcloudV2VolumesGetallNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud v2 volumes getall not found response has a 3xx status code +func (o *PcloudV2VolumesGetallNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud v2 volumes getall not found response has a 4xx status code +func (o *PcloudV2VolumesGetallNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud v2 volumes getall not found response has a 5xx status code +func (o *PcloudV2VolumesGetallNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud v2 volumes getall not found response a status code equal to that given +func (o *PcloudV2VolumesGetallNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the pcloud v2 volumes getall not found response +func (o *PcloudV2VolumesGetallNotFound) Code() int { + return 404 +} + +func (o *PcloudV2VolumesGetallNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallNotFound %s", 404, payload) +} + +func (o *PcloudV2VolumesGetallNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallNotFound %s", 404, payload) +} + +func (o *PcloudV2VolumesGetallNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesGetallNotFound) 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 +} + +// NewPcloudV2VolumesGetallInternalServerError creates a PcloudV2VolumesGetallInternalServerError with default headers values +func NewPcloudV2VolumesGetallInternalServerError() *PcloudV2VolumesGetallInternalServerError { + return &PcloudV2VolumesGetallInternalServerError{} +} + +/* +PcloudV2VolumesGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudV2VolumesGetallInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud v2 volumes getall internal server error response has a 2xx status code +func (o *PcloudV2VolumesGetallInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud v2 volumes getall internal server error response has a 3xx status code +func (o *PcloudV2VolumesGetallInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud v2 volumes getall internal server error response has a 4xx status code +func (o *PcloudV2VolumesGetallInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud v2 volumes getall internal server error response has a 5xx status code +func (o *PcloudV2VolumesGetallInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this pcloud v2 volumes getall internal server error response a status code equal to that given +func (o *PcloudV2VolumesGetallInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the pcloud v2 volumes getall internal server error response +func (o *PcloudV2VolumesGetallInternalServerError) Code() int { + return 500 +} + +func (o *PcloudV2VolumesGetallInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallInternalServerError %s", 500, payload) +} + +func (o *PcloudV2VolumesGetallInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallInternalServerError %s", 500, payload) +} + +func (o *PcloudV2VolumesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesGetallInternalServerError) 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/snapshots_client.go b/power/client/snapshots/snapshots_client.go index 3ad1d9fc..a4864748 100644 --- a/power/client/snapshots/snapshots_client.go +++ b/power/client/snapshots/snapshots_client.go @@ -60,11 +60,21 @@ 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. */ func (a *Client) V1SnapshotsGet(params *V1SnapshotsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1SnapshotsGetOK, error) { // TODO: Validate the params before sending @@ -103,7 +113,13 @@ 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. */ func (a *Client) V1SnapshotsGetall(params *V1SnapshotsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1SnapshotsGetallOK, error) { // TODO: Validate the params before sending @@ -141,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/add_host.go b/power/models/add_host.go index b0e6358a..b4220ea7 100644 --- a/power/models/add_host.go +++ b/power/models/add_host.go @@ -26,6 +26,9 @@ type AddHost struct { // System type // Required: true SysType *string `json:"sysType"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this add host @@ -40,6 +43,10 @@ func (m *AddHost) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -64,8 +71,48 @@ func (m *AddHost) validateSysType(formats strfmt.Registry) error { return nil } -// ContextValidate validates this add host based on context it is used +func (m *AddHost) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + +// ContextValidate validate this add host based on the context it is used func (m *AddHost) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AddHost) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } diff --git a/power/models/c_r_n.go b/power/models/c_r_n.go new file mode 100644 index 00000000..5dbfb827 --- /dev/null +++ b/power/models/c_r_n.go @@ -0,0 +1,27 @@ +// 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/strfmt" +) + +// CRN The CRN for this resource +// +// swagger:model CRN +type CRN string + +// Validate validates this c r n +func (m CRN) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this c r n based on context it is used +func (m CRN) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/power/models/capabilities_details.go b/power/models/capabilities_details.go new file mode 100644 index 00000000..9f11c204 --- /dev/null +++ b/power/models/capabilities_details.go @@ -0,0 +1,157 @@ +// 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" +) + +// CapabilitiesDetails capabilities details +// +// swagger:model CapabilitiesDetails +type CapabilitiesDetails struct { + + // Disaster Recovery Information + // Required: true + DisasterRecovery *DisasterRecovery `json:"disasterRecovery"` + + // Datacenter System Types Information + // Required: true + SupportedSystems *SupportedSystems `json:"supportedSystems"` +} + +// Validate validates this capabilities details +func (m *CapabilitiesDetails) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDisasterRecovery(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSupportedSystems(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CapabilitiesDetails) validateDisasterRecovery(formats strfmt.Registry) error { + + if err := validate.Required("disasterRecovery", "body", m.DisasterRecovery); err != nil { + return err + } + + if m.DisasterRecovery != nil { + if err := m.DisasterRecovery.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("disasterRecovery") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("disasterRecovery") + } + return err + } + } + + return nil +} + +func (m *CapabilitiesDetails) validateSupportedSystems(formats strfmt.Registry) error { + + if err := validate.Required("supportedSystems", "body", m.SupportedSystems); err != nil { + return err + } + + if m.SupportedSystems != nil { + if err := m.SupportedSystems.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("supportedSystems") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("supportedSystems") + } + return err + } + } + + return nil +} + +// ContextValidate validate this capabilities details based on the context it is used +func (m *CapabilitiesDetails) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDisasterRecovery(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSupportedSystems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CapabilitiesDetails) contextValidateDisasterRecovery(ctx context.Context, formats strfmt.Registry) error { + + if m.DisasterRecovery != nil { + + if err := m.DisasterRecovery.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("disasterRecovery") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("disasterRecovery") + } + return err + } + } + + return nil +} + +func (m *CapabilitiesDetails) contextValidateSupportedSystems(ctx context.Context, formats strfmt.Registry) error { + + if m.SupportedSystems != nil { + + if err := m.SupportedSystems.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("supportedSystems") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("supportedSystems") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CapabilitiesDetails) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CapabilitiesDetails) UnmarshalBinary(b []byte) error { + var res CapabilitiesDetails + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/create_cos_image_import_job.go b/power/models/create_cos_image_import_job.go index 642f5675..9c83a7b5 100644 --- a/power/models/create_cos_image_import_job.go +++ b/power/models/create_cos_image_import_job.go @@ -64,6 +64,9 @@ type CreateCosImageImportJob struct { // Type of storage; If only using storageType for storage selection then the storage pool with the most available space will be selected if storageType is not provided the storage type will default to 'tier3'. StorageType string `json:"storageType,omitempty"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this create cos image import job @@ -102,6 +105,10 @@ func (m *CreateCosImageImportJob) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -272,6 +279,23 @@ func (m *CreateCosImageImportJob) validateStorageAffinity(formats strfmt.Registr return nil } +func (m *CreateCosImageImportJob) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // ContextValidate validate this create cos image import job based on the context it is used func (m *CreateCosImageImportJob) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -284,6 +308,10 @@ func (m *CreateCosImageImportJob) ContextValidate(ctx context.Context, formats s res = append(res, err) } + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -332,6 +360,20 @@ func (m *CreateCosImageImportJob) contextValidateStorageAffinity(ctx context.Con return nil } +func (m *CreateCosImageImportJob) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *CreateCosImageImportJob) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/create_data_volume.go b/power/models/create_data_volume.go index 52d2a500..aa2aafc2 100644 --- a/power/models/create_data_volume.go +++ b/power/models/create_data_volume.go @@ -46,8 +46,8 @@ type CreateDataVolume struct { // Indicates if the volume should be replication enabled or not ReplicationEnabled *bool `json:"replicationEnabled,omitempty"` - // List of replication sites for volume replication - ReplicationSite []string `json:"replicationSite,omitempty"` + // List of replication site for volume replication + ReplicationSites []string `json:"replicationSites,omitempty"` // Indicates if the volume is shareable between VMs Shareable *bool `json:"shareable,omitempty"` @@ -56,6 +56,9 @@ type CreateDataVolume struct { // Required: true Size *float64 `json:"size"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // Volume pool where the volume will be created; if provided then affinityPolicy value will be ignored VolumePool string `json:"volumePool,omitempty"` } @@ -76,6 +79,10 @@ func (m *CreateDataVolume) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -142,8 +149,48 @@ func (m *CreateDataVolume) validateSize(formats strfmt.Registry) error { return nil } -// ContextValidate validates this create data volume based on context it is used +func (m *CreateDataVolume) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + +// ContextValidate validate this create data volume based on the context it is used func (m *CreateDataVolume) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateDataVolume) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } diff --git a/power/models/create_image.go b/power/models/create_image.go index d109378b..6603970b 100644 --- a/power/models/create_image.go +++ b/power/models/create_image.go @@ -63,6 +63,9 @@ type CreateImage struct { // Storage pool where the image will be loaded; if provided then storageAffinity will be ignored; Used only when importing an image from cloud storage. StoragePool string `json:"storagePool,omitempty"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this create image @@ -81,6 +84,10 @@ func (m *CreateImage) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -197,6 +204,23 @@ func (m *CreateImage) validateStorageAffinity(formats strfmt.Registry) error { return nil } +func (m *CreateImage) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // ContextValidate validate this create image based on the context it is used func (m *CreateImage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -205,6 +229,10 @@ func (m *CreateImage) ContextValidate(ctx context.Context, formats strfmt.Regist res = append(res, err) } + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -232,6 +260,20 @@ func (m *CreateImage) contextValidateStorageAffinity(ctx context.Context, format return nil } +func (m *CreateImage) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *CreateImage) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/datacenter.go b/power/models/datacenter.go index 2c33b15c..4dae0a17 100644 --- a/power/models/datacenter.go +++ b/power/models/datacenter.go @@ -24,6 +24,9 @@ type Datacenter struct { // Required: true Capabilities map[string]bool `json:"capabilities"` + // Additional Datacenter Capabilities Details + CapabilitiesDetails *CapabilitiesDetails `json:"capabilitiesDetails,omitempty"` + // Link to Datacenter Region Href string `json:"href,omitempty"` @@ -50,6 +53,10 @@ func (m *Datacenter) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCapabilitiesDetails(formats); err != nil { + res = append(res, err) + } + if err := m.validateLocation(formats); err != nil { res = append(res, err) } @@ -77,6 +84,25 @@ func (m *Datacenter) validateCapabilities(formats strfmt.Registry) error { return nil } +func (m *Datacenter) validateCapabilitiesDetails(formats strfmt.Registry) error { + if swag.IsZero(m.CapabilitiesDetails) { // not required + return nil + } + + if m.CapabilitiesDetails != nil { + if err := m.CapabilitiesDetails.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("capabilitiesDetails") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("capabilitiesDetails") + } + return err + } + } + + return nil +} + func (m *Datacenter) validateLocation(formats strfmt.Registry) error { if err := validate.Required("location", "body", m.Location); err != nil { @@ -190,6 +216,10 @@ func (m *Datacenter) validateType(formats strfmt.Registry) error { func (m *Datacenter) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error + if err := m.contextValidateCapabilitiesDetails(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateLocation(ctx, formats); err != nil { res = append(res, err) } @@ -200,6 +230,27 @@ func (m *Datacenter) ContextValidate(ctx context.Context, formats strfmt.Registr return nil } +func (m *Datacenter) contextValidateCapabilitiesDetails(ctx context.Context, formats strfmt.Registry) error { + + if m.CapabilitiesDetails != nil { + + if swag.IsZero(m.CapabilitiesDetails) { // not required + return nil + } + + if err := m.CapabilitiesDetails.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("capabilitiesDetails") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("capabilitiesDetails") + } + return err + } + } + + return nil +} + func (m *Datacenter) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error { if m.Location != nil { diff --git a/power/models/datacenter_location.go b/power/models/datacenter_location.go index 2e0fb838..a3bbcd91 100644 --- a/power/models/datacenter_location.go +++ b/power/models/datacenter_location.go @@ -23,6 +23,10 @@ type DatacenterLocation struct { // Required: true Region *string `json:"region"` + // The Datacenter location region display name + // Required: true + RegionDisplayName *string `json:"regionDisplayName"` + // The Datacenter location region type // Required: true Type *string `json:"type"` @@ -40,6 +44,10 @@ func (m *DatacenterLocation) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateRegionDisplayName(formats); err != nil { + res = append(res, err) + } + if err := m.validateType(formats); err != nil { res = append(res, err) } @@ -63,6 +71,15 @@ func (m *DatacenterLocation) validateRegion(formats strfmt.Registry) error { return nil } +func (m *DatacenterLocation) validateRegionDisplayName(formats strfmt.Registry) error { + + if err := validate.Required("regionDisplayName", "body", m.RegionDisplayName); err != nil { + return err + } + + return nil +} + func (m *DatacenterLocation) validateType(formats strfmt.Registry) error { if err := validate.Required("type", "body", m.Type); err != nil { diff --git a/power/models/disaster_recovery.go b/power/models/disaster_recovery.go new file mode 100644 index 00000000..f3e56e0c --- /dev/null +++ b/power/models/disaster_recovery.go @@ -0,0 +1,159 @@ +// 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" +) + +// DisasterRecovery disaster recovery +// +// swagger:model DisasterRecovery +type DisasterRecovery struct { + + // Asynchronous Replication Target Information + // Required: true + AsynchronousReplication *ReplicationService `json:"asynchronousReplication"` + + // Synchronous Replication Target Information + SynchronousReplication *ReplicationService `json:"synchronousReplication,omitempty"` +} + +// Validate validates this disaster recovery +func (m *DisasterRecovery) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAsynchronousReplication(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSynchronousReplication(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DisasterRecovery) validateAsynchronousReplication(formats strfmt.Registry) error { + + if err := validate.Required("asynchronousReplication", "body", m.AsynchronousReplication); err != nil { + return err + } + + if m.AsynchronousReplication != nil { + if err := m.AsynchronousReplication.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("asynchronousReplication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("asynchronousReplication") + } + return err + } + } + + return nil +} + +func (m *DisasterRecovery) validateSynchronousReplication(formats strfmt.Registry) error { + if swag.IsZero(m.SynchronousReplication) { // not required + return nil + } + + if m.SynchronousReplication != nil { + if err := m.SynchronousReplication.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("synchronousReplication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("synchronousReplication") + } + return err + } + } + + return nil +} + +// ContextValidate validate this disaster recovery based on the context it is used +func (m *DisasterRecovery) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAsynchronousReplication(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSynchronousReplication(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DisasterRecovery) contextValidateAsynchronousReplication(ctx context.Context, formats strfmt.Registry) error { + + if m.AsynchronousReplication != nil { + + if err := m.AsynchronousReplication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("asynchronousReplication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("asynchronousReplication") + } + return err + } + } + + return nil +} + +func (m *DisasterRecovery) contextValidateSynchronousReplication(ctx context.Context, formats strfmt.Registry) error { + + if m.SynchronousReplication != nil { + + if swag.IsZero(m.SynchronousReplication) { // not required + return nil + } + + if err := m.SynchronousReplication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("synchronousReplication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("synchronousReplication") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *DisasterRecovery) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DisasterRecovery) UnmarshalBinary(b []byte) error { + var res DisasterRecovery + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/get_bulk_volume.go b/power/models/get_bulk_volume.go new file mode 100644 index 00000000..0a72234d --- /dev/null +++ b/power/models/get_bulk_volume.go @@ -0,0 +1,71 @@ +// 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" +) + +// GetBulkVolume get bulk volume +// +// swagger:model GetBulkVolume +type GetBulkVolume struct { + + // List of volumes to be fetched + // Required: true + VolumeList []string `json:"volumeList"` +} + +// Validate validates this get bulk volume +func (m *GetBulkVolume) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVolumeList(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetBulkVolume) validateVolumeList(formats strfmt.Registry) error { + + if err := validate.Required("volumeList", "body", m.VolumeList); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this get bulk volume based on context it is used +func (m *GetBulkVolume) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *GetBulkVolume) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GetBulkVolume) UnmarshalBinary(b []byte) error { + var res GetBulkVolume + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/host.go b/power/models/host.go index 51e2d4a4..d1a86cc8 100644 --- a/power/models/host.go +++ b/power/models/host.go @@ -21,6 +21,9 @@ type Host struct { // Capacities of the host Capacity *HostCapacity `json:"capacity,omitempty"` + // crn + Crn CRN `json:"crn,omitempty"` + // Name of the host (chosen by the user) DisplayName string `json:"displayName,omitempty"` @@ -38,6 +41,9 @@ type Host struct { // System type SysType string `json:"sysType,omitempty"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this host @@ -48,10 +54,18 @@ func (m *Host) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateHostGroup(formats); err != nil { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -77,6 +91,23 @@ func (m *Host) validateCapacity(formats strfmt.Registry) error { return nil } +func (m *Host) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *Host) validateHostGroup(formats strfmt.Registry) error { if swag.IsZero(m.HostGroup) { // not required return nil @@ -96,6 +127,23 @@ func (m *Host) validateHostGroup(formats strfmt.Registry) error { return nil } +func (m *Host) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // ContextValidate validate this host based on the context it is used func (m *Host) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -104,10 +152,18 @@ func (m *Host) ContextValidate(ctx context.Context, formats strfmt.Registry) err res = append(res, err) } + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateHostGroup(ctx, formats); err != nil { res = append(res, err) } + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -135,6 +191,24 @@ func (m *Host) contextValidateCapacity(ctx context.Context, formats strfmt.Regis return nil } +func (m *Host) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *Host) contextValidateHostGroup(ctx context.Context, formats strfmt.Registry) error { if m.HostGroup != nil { @@ -156,6 +230,20 @@ func (m *Host) contextValidateHostGroup(ctx context.Context, formats strfmt.Regi return nil } +func (m *Host) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *Host) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/image.go b/power/models/image.go index 97b0ba08..20bc26d8 100644 --- a/power/models/image.go +++ b/power/models/image.go @@ -25,6 +25,9 @@ type Image struct { // Format: date-time CreationDate *strfmt.DateTime `json:"creationDate"` + // crn + Crn CRN `json:"crn,omitempty"` + // Description Description string `json:"description,omitempty"` @@ -69,6 +72,9 @@ type Image struct { // taskref Taskref *TaskReference `json:"taskref,omitempty"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // Image Volumes Volumes []*ImageVolume `json:"volumes"` } @@ -81,6 +87,10 @@ func (m *Image) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateImageID(formats); err != nil { res = append(res, err) } @@ -117,6 +127,10 @@ func (m *Image) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if err := m.validateVolumes(formats); err != nil { res = append(res, err) } @@ -140,6 +154,23 @@ func (m *Image) validateCreationDate(formats strfmt.Registry) error { return nil } +func (m *Image) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *Image) validateImageID(formats strfmt.Registry) error { if err := validate.Required("imageID", "body", m.ImageID); err != nil { @@ -245,6 +276,23 @@ func (m *Image) validateTaskref(formats strfmt.Registry) error { return nil } +func (m *Image) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + func (m *Image) validateVolumes(formats strfmt.Registry) error { if swag.IsZero(m.Volumes) { // not required return nil @@ -275,6 +323,10 @@ func (m *Image) validateVolumes(formats strfmt.Registry) error { func (m *Image) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateSpecifications(ctx, formats); err != nil { res = append(res, err) } @@ -283,6 +335,10 @@ func (m *Image) ContextValidate(ctx context.Context, formats strfmt.Registry) er res = append(res, err) } + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateVolumes(ctx, formats); err != nil { res = append(res, err) } @@ -293,6 +349,24 @@ func (m *Image) ContextValidate(ctx context.Context, formats strfmt.Registry) er return nil } +func (m *Image) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *Image) contextValidateSpecifications(ctx context.Context, formats strfmt.Registry) error { if m.Specifications != nil { @@ -335,6 +409,20 @@ func (m *Image) contextValidateTaskref(ctx context.Context, formats strfmt.Regis return nil } +func (m *Image) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + func (m *Image) contextValidateVolumes(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Volumes); i++ { diff --git a/power/models/image_reference.go b/power/models/image_reference.go index bd1811be..02a984cb 100644 --- a/power/models/image_reference.go +++ b/power/models/image_reference.go @@ -24,6 +24,9 @@ type ImageReference struct { // Format: date-time CreationDate *strfmt.DateTime `json:"creationDate"` + // crn + Crn CRN `json:"crn,omitempty"` + // Description // Required: true Description *string `json:"description"` @@ -70,6 +73,10 @@ func (m *ImageReference) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateDescription(formats); err != nil { res = append(res, err) } @@ -125,6 +132,23 @@ func (m *ImageReference) validateCreationDate(formats strfmt.Registry) error { return nil } +func (m *ImageReference) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *ImageReference) validateDescription(formats strfmt.Registry) error { if err := validate.Required("description", "body", m.Description); err != nil { @@ -225,6 +249,10 @@ func (m *ImageReference) validateStorageType(formats strfmt.Registry) error { func (m *ImageReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateSpecifications(ctx, formats); err != nil { res = append(res, err) } @@ -235,6 +263,24 @@ func (m *ImageReference) ContextValidate(ctx context.Context, formats strfmt.Reg return nil } +func (m *ImageReference) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *ImageReference) contextValidateSpecifications(ctx context.Context, formats strfmt.Registry) error { if m.Specifications != nil { diff --git a/power/models/image_specifications.go b/power/models/image_specifications.go index d5f71a0e..70ec4210 100644 --- a/power/models/image_specifications.go +++ b/power/models/image_specifications.go @@ -37,6 +37,9 @@ type ImageSpecifications struct { // Operating System OperatingSystem string `json:"operatingSystem,omitempty"` + + // Checksum of the source file (imported images only) + SourceChecksum string `json:"sourceChecksum,omitempty"` } // Validate validates this image specifications diff --git a/power/models/multi_volumes_create.go b/power/models/multi_volumes_create.go index 28ce2b24..61aaa4f4 100644 --- a/power/models/multi_volumes_create.go +++ b/power/models/multi_volumes_create.go @@ -49,8 +49,8 @@ type MultiVolumesCreate struct { // Indicates if the volume should be replication enabled or not ReplicationEnabled *bool `json:"replicationEnabled,omitempty"` - // List of replication sites for volume replication - ReplicationSite []string `json:"replicationSite,omitempty"` + // List of replication site for volume replication + ReplicationSites []string `json:"replicationSites,omitempty"` // Indicates if the volume is shareable between VMs Shareable *bool `json:"shareable,omitempty"` @@ -59,6 +59,9 @@ type MultiVolumesCreate struct { // Required: true Size *int64 `json:"size"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // Volume pool where the volume will be created; if provided then affinityPolicy value will be ignored VolumePool string `json:"volumePool,omitempty"` } @@ -79,6 +82,10 @@ func (m *MultiVolumesCreate) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -145,8 +152,48 @@ func (m *MultiVolumesCreate) validateSize(formats strfmt.Registry) error { return nil } -// ContextValidate validates this multi volumes create based on context it is used +func (m *MultiVolumesCreate) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + +// ContextValidate validate this multi volumes create based on the context it is used func (m *MultiVolumesCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MultiVolumesCreate) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } diff --git a/power/models/network.go b/power/models/network.go index 848f5280..db5ea45e 100644 --- a/power/models/network.go +++ b/power/models/network.go @@ -31,6 +31,9 @@ type Network struct { // (currently not available) cloud connections this network is attached CloudConnections []*NetworkCloudConnectionsItems0 `json:"cloudConnections,omitempty"` + // crn + Crn CRN `json:"crn,omitempty"` + // DHCP Managed Network DhcpManaged bool `json:"dhcpManaged,omitempty"` @@ -73,6 +76,9 @@ type Network struct { // Enum: ["vlan","pub-vlan","dhcp-vlan"] Type *string `json:"type"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // VLAN ID // Required: true VlanID *float64 `json:"vlanID"` @@ -94,6 +100,10 @@ func (m *Network) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateDNSServers(formats); err != nil { res = append(res, err) } @@ -126,6 +136,10 @@ func (m *Network) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if err := m.validateVlanID(formats); err != nil { res = append(res, err) } @@ -188,6 +202,23 @@ func (m *Network) validateCloudConnections(formats strfmt.Registry) error { return nil } +func (m *Network) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *Network) validateDNSServers(formats strfmt.Registry) error { if err := validate.Required("dnsServers", "body", m.DNSServers); err != nil { @@ -350,6 +381,23 @@ func (m *Network) validateType(formats strfmt.Registry) error { return nil } +func (m *Network) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + func (m *Network) validateVlanID(formats strfmt.Registry) error { if err := validate.Required("vlanID", "body", m.VlanID); err != nil { @@ -371,6 +419,10 @@ func (m *Network) ContextValidate(ctx context.Context, formats strfmt.Registry) res = append(res, err) } + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateIPAddressMetrics(ctx, formats); err != nil { res = append(res, err) } @@ -383,6 +435,10 @@ func (m *Network) ContextValidate(ctx context.Context, formats strfmt.Registry) res = append(res, err) } + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -432,6 +488,24 @@ func (m *Network) contextValidateCloudConnections(ctx context.Context, formats s return nil } +func (m *Network) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *Network) contextValidateIPAddressMetrics(ctx context.Context, formats strfmt.Registry) error { if m.IPAddressMetrics != nil { @@ -499,6 +573,20 @@ func (m *Network) contextValidatePublicIPAddressRanges(ctx context.Context, form return nil } +func (m *Network) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *Network) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/network_create.go b/power/models/network_create.go index 093cbaa0..21508e23 100644 --- a/power/models/network_create.go +++ b/power/models/network_create.go @@ -52,6 +52,9 @@ type NetworkCreate struct { // Required: true // Enum: ["vlan","pub-vlan","dhcp-vlan"] Type *string `json:"type"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this network create @@ -74,6 +77,10 @@ func (m *NetworkCreate) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -185,6 +192,23 @@ func (m *NetworkCreate) validateType(formats strfmt.Registry) error { return nil } +func (m *NetworkCreate) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // ContextValidate validate this network create based on the context it is used func (m *NetworkCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -197,6 +221,10 @@ func (m *NetworkCreate) ContextValidate(ctx context.Context, formats strfmt.Regi res = append(res, err) } + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -246,6 +274,20 @@ func (m *NetworkCreate) contextValidateIPAddressRanges(ctx context.Context, form return nil } +func (m *NetworkCreate) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *NetworkCreate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/network_port.go b/power/models/network_port.go index bcd23747..997c0cfa 100644 --- a/power/models/network_port.go +++ b/power/models/network_port.go @@ -208,7 +208,7 @@ type NetworkPortPvmInstance struct { // Link to pvm-instance resource Href string `json:"href,omitempty"` - // The attahed pvm-instance ID + // The attached pvm-instance ID PvmInstanceID string `json:"pvmInstanceID,omitempty"` } diff --git a/power/models/network_port_create.go b/power/models/network_port_create.go index d9c99e85..d3ebbb1b 100644 --- a/power/models/network_port_create.go +++ b/power/models/network_port_create.go @@ -8,6 +8,7 @@ package models import ( "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -22,15 +23,67 @@ type NetworkPortCreate struct { // The requested ip address of this port IPAddress string `json:"ipAddress,omitempty"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this network port create func (m *NetworkPortCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkPortCreate) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } -// ContextValidate validates this network port create based on context it is used +// ContextValidate validate this network port create based on the context it is used func (m *NetworkPortCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkPortCreate) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } diff --git a/power/models/network_reference.go b/power/models/network_reference.go index f4e765c6..a912a1e4 100644 --- a/power/models/network_reference.go +++ b/power/models/network_reference.go @@ -23,6 +23,9 @@ type NetworkReference struct { // access config AccessConfig AccessConfig `json:"accessConfig,omitempty"` + // crn + Crn CRN `json:"crn,omitempty"` + // DHCP Managed Network DhcpManaged bool `json:"dhcpManaged,omitempty"` @@ -64,6 +67,10 @@ func (m *NetworkReference) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateHref(formats); err != nil { res = append(res, err) } @@ -111,6 +118,23 @@ func (m *NetworkReference) validateAccessConfig(formats strfmt.Registry) error { return nil } +func (m *NetworkReference) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *NetworkReference) validateHref(formats strfmt.Registry) error { if err := validate.Required("href", "body", m.Href); err != nil { @@ -217,6 +241,10 @@ func (m *NetworkReference) ContextValidate(ctx context.Context, formats strfmt.R res = append(res, err) } + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -241,6 +269,24 @@ func (m *NetworkReference) contextValidateAccessConfig(ctx context.Context, form return nil } +func (m *NetworkReference) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *NetworkReference) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/p_vm_instance.go b/power/models/p_vm_instance.go index 525c15d6..457affd7 100644 --- a/power/models/p_vm_instance.go +++ b/power/models/p_vm_instance.go @@ -31,6 +31,9 @@ type PVMInstance struct { // Format: date-time CreationDate strfmt.DateTime `json:"creationDate,omitempty"` + // crn + Crn CRN `json:"crn,omitempty"` + // The custom deployment type DeploymentType string `json:"deploymentType,omitempty"` @@ -155,6 +158,9 @@ type PVMInstance struct { // Format: date-time UpdatedDate strfmt.DateTime `json:"updatedDate,omitempty"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // The pvm instance virtual CPU information VirtualCores *VirtualCores `json:"virtualCores,omitempty"` @@ -179,6 +185,10 @@ func (m *PVMInstance) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateDiskSize(formats); err != nil { res = append(res, err) } @@ -251,6 +261,10 @@ func (m *PVMInstance) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if err := m.validateVirtualCores(formats); err != nil { res = append(res, err) } @@ -322,6 +336,23 @@ func (m *PVMInstance) validateCreationDate(formats strfmt.Registry) error { return nil } +func (m *PVMInstance) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *PVMInstance) validateDiskSize(formats strfmt.Registry) error { if err := validate.Required("diskSize", "body", m.DiskSize); err != nil { @@ -605,6 +636,23 @@ func (m *PVMInstance) validateUpdatedDate(formats strfmt.Registry) error { return nil } +func (m *PVMInstance) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + func (m *PVMInstance) validateVirtualCores(formats strfmt.Registry) error { if swag.IsZero(m.VirtualCores) { // not required return nil @@ -645,6 +693,10 @@ func (m *PVMInstance) ContextValidate(ctx context.Context, formats strfmt.Regist res = append(res, err) } + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateFault(ctx, formats); err != nil { res = append(res, err) } @@ -669,6 +721,10 @@ func (m *PVMInstance) ContextValidate(ctx context.Context, formats strfmt.Regist res = append(res, err) } + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateVirtualCores(ctx, formats); err != nil { res = append(res, err) } @@ -725,6 +781,24 @@ func (m *PVMInstance) contextValidateConsoleLanguage(ctx context.Context, format return nil } +func (m *PVMInstance) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *PVMInstance) contextValidateFault(ctx context.Context, formats strfmt.Registry) error { if m.Fault != nil { @@ -863,6 +937,20 @@ func (m *PVMInstance) contextValidateSrcs(ctx context.Context, formats strfmt.Re return nil } +func (m *PVMInstance) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + func (m *PVMInstance) contextValidateVirtualCores(ctx context.Context, formats strfmt.Registry) error { if m.VirtualCores != nil { diff --git a/power/models/p_vm_instance_capture.go b/power/models/p_vm_instance_capture.go index 1f0976d1..1094909f 100644 --- a/power/models/p_vm_instance_capture.go +++ b/power/models/p_vm_instance_capture.go @@ -46,6 +46,9 @@ type PVMInstanceCapture struct { // Cloud Storage Secret key CloudStorageSecretKey string `json:"cloudStorageSecretKey,omitempty"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this p VM instance capture @@ -60,6 +63,10 @@ func (m *PVMInstanceCapture) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -121,8 +128,48 @@ func (m *PVMInstanceCapture) validateCaptureName(formats strfmt.Registry) error return nil } -// ContextValidate validates this p VM instance capture based on context it is used +func (m *PVMInstanceCapture) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + +// ContextValidate validate this p VM instance capture based on the context it is used func (m *PVMInstanceCapture) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceCapture) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } diff --git a/power/models/p_vm_instance_create.go b/power/models/p_vm_instance_create.go index c8ec2702..a44538bb 100644 --- a/power/models/p_vm_instance_create.go +++ b/power/models/p_vm_instance_create.go @@ -21,6 +21,9 @@ import ( // swagger:model PVMInstanceCreate type PVMInstanceCreate struct { + // Indicates if the boot volume should be replication enabled or not + BootVolumeReplicationEnabled *bool `json:"bootVolumeReplicationEnabled,omitempty"` + // The deployment of a dedicated host DeploymentTarget *DeploymentTarget `json:"deploymentTarget,omitempty"` @@ -76,6 +79,9 @@ type PVMInstanceCreate struct { // Number of duplicate instances to create in this request Replicants float64 `json:"replicants,omitempty"` + // Indicates the replication site of the boot volume + ReplicationSites []string `json:"replicationSites"` + // Name of the server to create // Required: true ServerName *string `json:"serverName"` @@ -112,6 +118,9 @@ type PVMInstanceCreate struct { // Cloud init user defined data; For FLS, only cloud-config instance-data is supported and data must not be compressed or exceed 63K UserData string `json:"userData,omitempty"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // The pvm instance virtual CPU information VirtualCores *VirtualCores `json:"virtualCores,omitempty"` @@ -179,6 +188,10 @@ func (m *PVMInstanceCreate) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if err := m.validateVirtualCores(formats); err != nil { res = append(res, err) } @@ -542,6 +555,23 @@ func (m *PVMInstanceCreate) validateStorageConnectionV2(formats strfmt.Registry) return nil } +func (m *PVMInstanceCreate) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + func (m *PVMInstanceCreate) validateVirtualCores(formats strfmt.Registry) error { if swag.IsZero(m.VirtualCores) { // not required return nil @@ -585,6 +615,10 @@ func (m *PVMInstanceCreate) ContextValidate(ctx context.Context, formats strfmt. res = append(res, err) } + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateVirtualCores(ctx, formats); err != nil { res = append(res, err) } @@ -701,6 +735,20 @@ func (m *PVMInstanceCreate) contextValidateStorageAffinity(ctx context.Context, return nil } +func (m *PVMInstanceCreate) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + func (m *PVMInstanceCreate) contextValidateVirtualCores(ctx context.Context, formats strfmt.Registry) error { if m.VirtualCores != nil { diff --git a/power/models/p_vm_instance_reference.go b/power/models/p_vm_instance_reference.go index 54e5d7b1..d15a4159 100644 --- a/power/models/p_vm_instance_reference.go +++ b/power/models/p_vm_instance_reference.go @@ -31,6 +31,9 @@ type PVMInstanceReference struct { // Format: date-time CreationDate strfmt.DateTime `json:"creationDate,omitempty"` + // crn + Crn CRN `json:"crn,omitempty"` + // Size of allocated disk (in GB) // Required: true DiskSize *float64 `json:"diskSize"` @@ -168,6 +171,10 @@ func (m *PVMInstanceReference) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateDiskSize(formats); err != nil { res = append(res, err) } @@ -303,6 +310,23 @@ func (m *PVMInstanceReference) validateCreationDate(formats strfmt.Registry) err return nil } +func (m *PVMInstanceReference) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *PVMInstanceReference) validateDiskSize(formats strfmt.Registry) error { if err := validate.Required("diskSize", "body", m.DiskSize); err != nil { @@ -605,6 +629,10 @@ func (m *PVMInstanceReference) ContextValidate(ctx context.Context, formats strf res = append(res, err) } + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateFault(ctx, formats); err != nil { res = append(res, err) } @@ -685,6 +713,24 @@ func (m *PVMInstanceReference) contextValidateConsoleLanguage(ctx context.Contex return nil } +func (m *PVMInstanceReference) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *PVMInstanceReference) contextValidateFault(ctx context.Context, formats strfmt.Registry) error { if m.Fault != nil { diff --git a/power/models/p_vm_instance_reference_v2.go b/power/models/p_vm_instance_reference_v2.go index 4fcc6864..929e93a8 100644 --- a/power/models/p_vm_instance_reference_v2.go +++ b/power/models/p_vm_instance_reference_v2.go @@ -31,6 +31,9 @@ type PVMInstanceReferenceV2 struct { // Format: date-time CreationDate strfmt.DateTime `json:"creationDate,omitempty"` + // crn + Crn CRN `json:"crn,omitempty"` + // The pvm instance deployment information // Required: true Deployment *PvmInstanceDeployment `json:"deployment"` @@ -92,6 +95,10 @@ func (m *PVMInstanceReferenceV2) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateDeployment(formats); err != nil { res = append(res, err) } @@ -197,6 +204,23 @@ func (m *PVMInstanceReferenceV2) validateCreationDate(formats strfmt.Registry) e return nil } +func (m *PVMInstanceReferenceV2) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *PVMInstanceReferenceV2) validateDeployment(formats strfmt.Registry) error { if err := validate.Required("deployment", "body", m.Deployment); err != nil { @@ -408,6 +432,10 @@ func (m *PVMInstanceReferenceV2) ContextValidate(ctx context.Context, formats st res = append(res, err) } + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateDeployment(ctx, formats); err != nil { res = append(res, err) } @@ -484,6 +512,24 @@ func (m *PVMInstanceReferenceV2) contextValidateCores(ctx context.Context, forma return nil } +func (m *PVMInstanceReferenceV2) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *PVMInstanceReferenceV2) contextValidateDeployment(ctx context.Context, formats strfmt.Registry) error { if m.Deployment != nil { diff --git a/power/models/p_vm_instance_update_response.go b/power/models/p_vm_instance_update_response.go index 21176e39..4a373de2 100644 --- a/power/models/p_vm_instance_update_response.go +++ b/power/models/p_vm_instance_update_response.go @@ -36,7 +36,7 @@ type PVMInstanceUpdateResponse struct { // Number of processors allocated Processors float64 `json:"processors,omitempty"` - // Name of the server to create + // Name of the server ServerName string `json:"serverName,omitempty"` // URL to check for status of the operation (for now, just the URL for the GET on the server, which has status information from powervc) diff --git a/power/models/replication_service.go b/power/models/replication_service.go new file mode 100644 index 00000000..c16beb90 --- /dev/null +++ b/power/models/replication_service.go @@ -0,0 +1,141 @@ +// 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" + "github.com/go-openapi/validate" +) + +// ReplicationService replication service +// +// swagger:model ReplicationService +type ReplicationService struct { + + // Service Enabled + // Required: true + Enabled *bool `json:"enabled"` + + // List of all replication targets + // Required: true + TargetLocations []*ReplicationTargetLocation `json:"targetLocations"` +} + +// Validate validates this replication service +func (m *ReplicationService) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEnabled(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTargetLocations(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ReplicationService) validateEnabled(formats strfmt.Registry) error { + + if err := validate.Required("enabled", "body", m.Enabled); err != nil { + return err + } + + return nil +} + +func (m *ReplicationService) validateTargetLocations(formats strfmt.Registry) error { + + if err := validate.Required("targetLocations", "body", m.TargetLocations); err != nil { + return err + } + + for i := 0; i < len(m.TargetLocations); i++ { + if swag.IsZero(m.TargetLocations[i]) { // not required + continue + } + + if m.TargetLocations[i] != nil { + if err := m.TargetLocations[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("targetLocations" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("targetLocations" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this replication service based on the context it is used +func (m *ReplicationService) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTargetLocations(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ReplicationService) contextValidateTargetLocations(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TargetLocations); i++ { + + if m.TargetLocations[i] != nil { + + if swag.IsZero(m.TargetLocations[i]) { // not required + return nil + } + + if err := m.TargetLocations[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("targetLocations" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("targetLocations" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ReplicationService) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ReplicationService) UnmarshalBinary(b []byte) error { + var res ReplicationService + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/replication_target_location.go b/power/models/replication_target_location.go new file mode 100644 index 00000000..453edf48 --- /dev/null +++ b/power/models/replication_target_location.go @@ -0,0 +1,108 @@ +// 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" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ReplicationTargetLocation replication target location +// +// swagger:model ReplicationTargetLocation +type ReplicationTargetLocation struct { + + // regionZone of replication site + Region string `json:"region,omitempty"` + + // the replication site is active / down + // Enum: ["active","down"] + Status string `json:"status,omitempty"` +} + +// Validate validates this replication target location +func (m *ReplicationTargetLocation) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var replicationTargetLocationTypeStatusPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["active","down"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + replicationTargetLocationTypeStatusPropEnum = append(replicationTargetLocationTypeStatusPropEnum, v) + } +} + +const ( + + // ReplicationTargetLocationStatusActive captures enum value "active" + ReplicationTargetLocationStatusActive string = "active" + + // ReplicationTargetLocationStatusDown captures enum value "down" + ReplicationTargetLocationStatusDown string = "down" +) + +// prop value enum +func (m *ReplicationTargetLocation) validateStatusEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, replicationTargetLocationTypeStatusPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *ReplicationTargetLocation) validateStatus(formats strfmt.Registry) error { + if swag.IsZero(m.Status) { // not required + return nil + } + + // value enum + if err := m.validateStatusEnum("status", "body", m.Status); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this replication target location based on context it is used +func (m *ReplicationTargetLocation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ReplicationTargetLocation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ReplicationTargetLocation) UnmarshalBinary(b []byte) error { + var res ReplicationTargetLocation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/s_a_p_create.go b/power/models/s_a_p_create.go index 36187301..830973ef 100644 --- a/power/models/s_a_p_create.go +++ b/power/models/s_a_p_create.go @@ -20,6 +20,9 @@ import ( // swagger:model SAPCreate type SAPCreate struct { + // Indicates if the boot volume should be replication enabled or not + BootVolumeReplicationEnabled *bool `json:"bootVolumeReplicationEnabled,omitempty"` + // The deployment of a dedicated host DeploymentTarget *DeploymentTarget `json:"deploymentTarget,omitempty"` @@ -51,6 +54,9 @@ type SAPCreate struct { // Required: true ProfileID *string `json:"profileID"` + // Indicates the replication site of the boot volume + ReplicationSites []string `json:"replicationSites"` + // The name of the SSH Key to provide to the server for authenticating SSHKeyName string `json:"sshKeyName,omitempty"` @@ -69,6 +75,9 @@ type SAPCreate struct { // Cloud init user defined data; For FLS, only cloud-config instance-data is supported and data must not be compressed or exceed 63K UserData string `json:"userData,omitempty"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // List of Volume IDs to attach to the pvm-instance on creation VolumeIDs []string `json:"volumeIDs"` } @@ -109,6 +118,10 @@ func (m *SAPCreate) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -243,6 +256,23 @@ func (m *SAPCreate) validateStorageAffinity(formats strfmt.Registry) error { return nil } +func (m *SAPCreate) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // ContextValidate validate this s a p create based on the context it is used func (m *SAPCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -267,6 +297,10 @@ func (m *SAPCreate) ContextValidate(ctx context.Context, formats strfmt.Registry res = append(res, err) } + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -379,6 +413,20 @@ func (m *SAPCreate) contextValidateStorageAffinity(ctx context.Context, formats return nil } +func (m *SAPCreate) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *SAPCreate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/shared_processor_pool.go b/power/models/shared_processor_pool.go index 6cd9a57f..2a627441 100644 --- a/power/models/shared_processor_pool.go +++ b/power/models/shared_processor_pool.go @@ -28,6 +28,9 @@ type SharedProcessorPool struct { // Required: true AvailableCores *float64 `json:"availableCores"` + // crn + Crn CRN `json:"crn,omitempty"` + // The host group the host belongs to HostGroup string `json:"hostGroup,omitempty"` @@ -54,6 +57,9 @@ type SharedProcessorPool struct { // The status details of the Shared Processor Pool StatusDetail string `json:"statusDetail,omitempty"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this shared processor pool @@ -68,6 +74,10 @@ func (m *SharedProcessorPool) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateID(formats); err != nil { res = append(res, err) } @@ -84,6 +94,10 @@ func (m *SharedProcessorPool) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -108,6 +122,23 @@ func (m *SharedProcessorPool) validateAvailableCores(formats strfmt.Registry) er return nil } +func (m *SharedProcessorPool) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *SharedProcessorPool) validateID(formats strfmt.Registry) error { if err := validate.Required("id", "body", m.ID); err != nil { @@ -161,20 +192,63 @@ func (m *SharedProcessorPool) validateSharedProcessorPoolPlacementGroups(formats return nil } +func (m *SharedProcessorPool) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // ContextValidate validate this shared processor pool based on the context it is used func (m *SharedProcessorPool) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateSharedProcessorPoolPlacementGroups(ctx, formats); err != nil { res = append(res, err) } + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } +func (m *SharedProcessorPool) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *SharedProcessorPool) contextValidateSharedProcessorPoolPlacementGroups(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.SharedProcessorPoolPlacementGroups); i++ { @@ -200,6 +274,20 @@ func (m *SharedProcessorPool) contextValidateSharedProcessorPoolPlacementGroups( return nil } +func (m *SharedProcessorPool) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *SharedProcessorPool) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/shared_processor_pool_create.go b/power/models/shared_processor_pool_create.go index a951586a..95eaf671 100644 --- a/power/models/shared_processor_pool_create.go +++ b/power/models/shared_processor_pool_create.go @@ -36,6 +36,9 @@ type SharedProcessorPoolCreate struct { // The amount of reserved processor cores for the Shared Processor Pool; only integers allowed, no fractional values // Required: true ReservedCores *int64 `json:"reservedCores"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this shared processor pool create @@ -54,6 +57,10 @@ func (m *SharedProcessorPoolCreate) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -87,8 +94,48 @@ func (m *SharedProcessorPoolCreate) validateReservedCores(formats strfmt.Registr return nil } -// ContextValidate validates this shared processor pool create based on context it is used +func (m *SharedProcessorPoolCreate) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + +// ContextValidate validate this shared processor pool create based on the context it is used func (m *SharedProcessorPoolCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SharedProcessorPoolCreate) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } diff --git a/power/models/snapshot.go b/power/models/snapshot.go index c5d2fc31..3d7319f7 100644 --- a/power/models/snapshot.go +++ b/power/models/snapshot.go @@ -26,6 +26,9 @@ type Snapshot struct { // Format: date-time CreationDate strfmt.DateTime `json:"creationDate,omitempty"` + // crn + Crn CRN `json:"crn,omitempty"` + // Description of the PVM instance snapshot Description string `json:"description,omitempty"` @@ -64,6 +67,10 @@ func (m *Snapshot) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateLastUpdateDate(formats); err != nil { res = append(res, err) } @@ -102,6 +109,23 @@ func (m *Snapshot) validateCreationDate(formats strfmt.Registry) error { return nil } +func (m *Snapshot) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *Snapshot) validateLastUpdateDate(formats strfmt.Registry) error { if swag.IsZero(m.LastUpdateDate) { // not required return nil @@ -150,8 +174,35 @@ func (m *Snapshot) validateVolumeSnapshots(formats strfmt.Registry) error { return nil } -// ContextValidate validates this snapshot based on context it is used +// ContextValidate validate this snapshot based on the context it is used func (m *Snapshot) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Snapshot) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + return nil } diff --git a/power/models/snapshot_create.go b/power/models/snapshot_create.go index 00377110..8d85520a 100644 --- a/power/models/snapshot_create.go +++ b/power/models/snapshot_create.go @@ -26,6 +26,9 @@ type SnapshotCreate struct { // Required: true Name *string `json:"name"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // List of volumes to include in the PVM instance snapshot VolumeIDs []string `json:"volumeIDs"` } @@ -38,6 +41,10 @@ func (m *SnapshotCreate) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -53,8 +60,48 @@ func (m *SnapshotCreate) validateName(formats strfmt.Registry) error { return nil } -// ContextValidate validates this snapshot create based on context it is used +func (m *SnapshotCreate) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + +// ContextValidate validate this snapshot create based on the context it is used func (m *SnapshotCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SnapshotCreate) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } diff --git a/power/models/snapshot_create_response.go b/power/models/snapshot_create_response.go index 61214fb3..eda2822b 100644 --- a/power/models/snapshot_create_response.go +++ b/power/models/snapshot_create_response.go @@ -19,25 +19,56 @@ import ( // swagger:model SnapshotCreateResponse type SnapshotCreateResponse struct { + // crn + Crn CRN `json:"crn,omitempty"` + // ID of the PVM instance snapshot // Required: true SnapshotID *string `json:"snapshotID"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this snapshot create response func (m *SnapshotCreateResponse) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateSnapshotID(formats); err != nil { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } +func (m *SnapshotCreateResponse) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *SnapshotCreateResponse) validateSnapshotID(formats strfmt.Registry) error { if err := validate.Required("snapshotID", "body", m.SnapshotID); err != nil { @@ -47,8 +78,70 @@ func (m *SnapshotCreateResponse) validateSnapshotID(formats strfmt.Registry) err return nil } -// ContextValidate validates this snapshot create response based on context it is used +func (m *SnapshotCreateResponse) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + +// ContextValidate validate this snapshot create response based on the context it is used func (m *SnapshotCreateResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SnapshotCreateResponse) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + +func (m *SnapshotCreateResponse) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + 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 2974fef6..570c3a4f 100644 --- a/power/models/snapshot_v1.go +++ b/power/models/snapshot_v1.go @@ -19,27 +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"` - // The snapshot UUID. + // crn + Crn CRN `json:"crn,omitempty"` + + // 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"` @@ -56,6 +59,10 @@ func (m *SnapshotV1) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateID(formats); err != nil { res = append(res, err) } @@ -98,6 +105,23 @@ func (m *SnapshotV1) validateCreationDate(formats strfmt.Registry) error { return nil } +func (m *SnapshotV1) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *SnapshotV1) validateID(formats strfmt.Registry) error { if err := validate.Required("id", "body", m.ID); err != nil { @@ -155,8 +179,35 @@ func (m *SnapshotV1) validateVolumeID(formats strfmt.Registry) error { return nil } -// ContextValidate validates this snapshot v1 based on context it is used +// ContextValidate validate this snapshot v1 based on the context it is used func (m *SnapshotV1) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SnapshotV1) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + return nil } diff --git a/power/models/supported_systems.go b/power/models/supported_systems.go new file mode 100644 index 00000000..de991f0f --- /dev/null +++ b/power/models/supported_systems.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" +) + +// SupportedSystems supported systems +// +// swagger:model SupportedSystems +type SupportedSystems struct { + + // List of all available dedicated host types + // Required: true + Dedicated []string `json:"dedicated"` + + // List of all available host types + // Required: true + General []string `json:"general"` +} + +// Validate validates this supported systems +func (m *SupportedSystems) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDedicated(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGeneral(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SupportedSystems) validateDedicated(formats strfmt.Registry) error { + + if err := validate.Required("dedicated", "body", m.Dedicated); err != nil { + return err + } + + return nil +} + +func (m *SupportedSystems) validateGeneral(formats strfmt.Registry) error { + + if err := validate.Required("general", "body", m.General); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this supported systems based on context it is used +func (m *SupportedSystems) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SupportedSystems) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SupportedSystems) UnmarshalBinary(b []byte) error { + var res SupportedSystems + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/system_pool.go b/power/models/system_pool.go index fc5ed175..42d0c350 100644 --- a/power/models/system_pool.go +++ b/power/models/system_pool.go @@ -22,6 +22,9 @@ type SystemPool struct { // Advertised capacity cores and memory (GB) Capacity *System `json:"capacity,omitempty"` + // Core allocation increment + CoreIncrement float64 `json:"coreIncrement,omitempty"` + // Processor to Memory (GB) Ratio CoreMemoryRatio float64 `json:"coreMemoryRatio,omitempty"` diff --git a/power/models/tags.go b/power/models/tags.go new file mode 100644 index 00000000..477c7687 --- /dev/null +++ b/power/models/tags.go @@ -0,0 +1,27 @@ +// 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/strfmt" +) + +// Tags List of user tags +// +// swagger:model Tags +type Tags []string + +// Validate validates this tags +func (m Tags) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this tags based on context it is used +func (m Tags) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/power/models/volume.go b/power/models/volume.go index 97e5ca8b..5394c368 100644 --- a/power/models/volume.go +++ b/power/models/volume.go @@ -26,7 +26,7 @@ type Volume struct { // true if volume is auxiliary otherwise false Auxiliary *bool `json:"auxiliary,omitempty"` - // Indicates if the volume is the server's boot volume + // Indicates if the volume is the server's boot volume. Only returned when querying a server's attached volumes BootVolume *bool `json:"bootVolume,omitempty"` // Indicates if the volume is boot capable @@ -40,12 +40,19 @@ type Volume struct { // Format: date-time CreationDate *strfmt.DateTime `json:"creationDate"` + // crn + Crn CRN `json:"crn,omitempty"` + // Indicates if the volume should be deleted when the server terminates DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` // Type of Disk DiskType string `json:"diskType,omitempty"` + // Freeze time of remote copy relationship + // Format: date-time + FreezeTime *strfmt.DateTime `json:"freezeTime,omitempty"` + // Volume Group ID GroupID string `json:"groupID,omitempty"` @@ -80,8 +87,8 @@ type Volume struct { // True if volume is replication enabled otherwise false ReplicationEnabled *bool `json:"replicationEnabled,omitempty"` - // List of replication sites for volume replication - ReplicationSite []string `json:"replicationSite,omitempty"` + // List of replication site for volume replication + ReplicationSites []string `json:"replicationSites,omitempty"` // Replication status of a volume ReplicationStatus string `json:"replicationStatus,omitempty"` @@ -99,6 +106,9 @@ type Volume struct { // Volume State State string `json:"state,omitempty"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // Volume ID // Required: true VolumeID *string `json:"volumeID"` @@ -121,6 +131,14 @@ func (m *Volume) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFreezeTime(formats); err != nil { + res = append(res, err) + } + if err := m.validateLastUpdateDate(formats); err != nil { res = append(res, err) } @@ -137,6 +155,10 @@ func (m *Volume) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if err := m.validateVolumeID(formats); err != nil { res = append(res, err) } @@ -160,6 +182,35 @@ func (m *Volume) validateCreationDate(formats strfmt.Registry) error { return nil } +func (m *Volume) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + +func (m *Volume) validateFreezeTime(formats strfmt.Registry) error { + if swag.IsZero(m.FreezeTime) { // not required + return nil + } + + if err := validate.FormatOf("freezeTime", "body", "date-time", m.FreezeTime.String(), formats); err != nil { + return err + } + + return nil +} + func (m *Volume) validateLastUpdateDate(formats strfmt.Registry) error { if err := validate.Required("lastUpdateDate", "body", m.LastUpdateDate); err != nil { @@ -233,6 +284,23 @@ func (m *Volume) validateSize(formats strfmt.Registry) error { return nil } +func (m *Volume) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + func (m *Volume) validateVolumeID(formats strfmt.Registry) error { if err := validate.Required("volumeID", "body", m.VolumeID); err != nil { @@ -242,8 +310,53 @@ func (m *Volume) validateVolumeID(formats strfmt.Registry) error { return nil } -// ContextValidate validates this volume based on context it is used +// ContextValidate validate this volume based on the context it is used func (m *Volume) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Volume) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + +func (m *Volume) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } diff --git a/power/models/volume_group.go b/power/models/volume_group.go index 077a3dbd..77e8f9dc 100644 --- a/power/models/volume_group.go +++ b/power/models/volume_group.go @@ -19,6 +19,9 @@ import ( // swagger:model VolumeGroup type VolumeGroup struct { + // Indicates whether the volume group is for auxiliary volumes or master volumes + Auxiliary *bool `json:"auxiliary,omitempty"` + // The name of consistencyGroup at storage host level ConsistencyGroupName string `json:"consistencyGroupName,omitempty"` @@ -30,6 +33,9 @@ type VolumeGroup struct { // Required: true Name *string `json:"name"` + // Indicates the replication site of the volume group + ReplicationSites []string `json:"replicationSites"` + // Replication status of volume group ReplicationStatus string `json:"replicationStatus,omitempty"` @@ -38,6 +44,9 @@ type VolumeGroup struct { // Status details of the volume group StatusDescription *StatusDescription `json:"statusDescription,omitempty"` + + // Indicates the storage pool of the volume group + StoragePool string `json:"storagePool,omitempty"` } // Validate validates this volume group diff --git a/power/models/volume_group_details.go b/power/models/volume_group_details.go index 2642a06d..fb9a4edf 100644 --- a/power/models/volume_group_details.go +++ b/power/models/volume_group_details.go @@ -19,6 +19,9 @@ import ( // swagger:model VolumeGroupDetails type VolumeGroupDetails struct { + // Indicates whether the volume group is for auxiliary volumes or master volumes + Auxiliary *bool `json:"auxiliary,omitempty"` + // The name of volume group at storage host level ConsistencyGroupName string `json:"consistencyGroupName,omitempty"` @@ -30,6 +33,9 @@ type VolumeGroupDetails struct { // Required: true Name *string `json:"name"` + // Indicates the replication site of the volume group + ReplicationSites []string `json:"replicationSites"` + // Replication status of volume group ReplicationStatus string `json:"replicationStatus,omitempty"` @@ -39,6 +45,9 @@ type VolumeGroupDetails struct { // Status details of the volume group StatusDescription *StatusDescription `json:"statusDescription,omitempty"` + // Indicates the storage pool of the volume group + StoragePool string `json:"storagePool,omitempty"` + // List of volume IDs,member of VolumeGroup VolumeIDs []string `json:"volumeIDs"` } diff --git a/power/models/volume_info.go b/power/models/volume_info.go index 26f5b3f2..59905e25 100644 --- a/power/models/volume_info.go +++ b/power/models/volume_info.go @@ -8,6 +8,7 @@ package models import ( "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -17,6 +18,9 @@ import ( // swagger:model VolumeInfo type VolumeInfo struct { + // crn + Crn CRN `json:"crn,omitempty"` + // Name of the volume Name string `json:"name,omitempty"` @@ -26,11 +30,64 @@ type VolumeInfo struct { // Validate validates this volume info func (m *VolumeInfo) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumeInfo) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + return nil } -// ContextValidate validates this volume info based on context it is used +// ContextValidate validate this volume info based on the context it is used func (m *VolumeInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumeInfo) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + return nil } diff --git a/power/models/volume_reference.go b/power/models/volume_reference.go index 1998307a..037c3b43 100644 --- a/power/models/volume_reference.go +++ b/power/models/volume_reference.go @@ -26,7 +26,7 @@ type VolumeReference struct { // true if volume is auxiliary otherwise false Auxiliary *bool `json:"auxiliary,omitempty"` - // Indicates if the volume is the server's boot volume + // Indicates if the volume is the server's boot volume. Only returned when querying a server's attached volumes BootVolume *bool `json:"bootVolume,omitempty"` // Indicates if the volume is boot capable @@ -41,6 +41,9 @@ type VolumeReference struct { // Format: date-time CreationDate *strfmt.DateTime `json:"creationDate"` + // crn + Crn CRN `json:"crn,omitempty"` + // Indicates if the volume should be deleted when the server terminates DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` @@ -48,6 +51,10 @@ type VolumeReference struct { // Required: true DiskType *string `json:"diskType"` + // Freeze time of remote copy relationship + // Format: date-time + FreezeTime *strfmt.DateTime `json:"freezeTime,omitempty"` + // Volume Group ID GroupID string `json:"groupID,omitempty"` @@ -86,8 +93,8 @@ type VolumeReference struct { // True if volume is replication enabled otherwise false ReplicationEnabled *bool `json:"replicationEnabled,omitempty"` - // List of replication sites for volume replication - ReplicationSite []string `json:"replicationSite,omitempty"` + // List of replication site for volume replication + ReplicationSites []string `json:"replicationSites,omitempty"` // shows the replication status of a volume ReplicationStatus string `json:"replicationStatus,omitempty"` @@ -107,6 +114,9 @@ type VolumeReference struct { // Required: true State *string `json:"state"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // Volume ID // Required: true VolumeID *string `json:"volumeID"` @@ -134,10 +144,18 @@ func (m *VolumeReference) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateDiskType(formats); err != nil { res = append(res, err) } + if err := m.validateFreezeTime(formats); err != nil { + res = append(res, err) + } + if err := m.validateHref(formats); err != nil { res = append(res, err) } @@ -166,6 +184,10 @@ func (m *VolumeReference) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if err := m.validateVolumeID(formats); err != nil { res = append(res, err) } @@ -202,6 +224,23 @@ func (m *VolumeReference) validateCreationDate(formats strfmt.Registry) error { return nil } +func (m *VolumeReference) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *VolumeReference) validateDiskType(formats strfmt.Registry) error { if err := validate.Required("diskType", "body", m.DiskType); err != nil { @@ -211,6 +250,18 @@ func (m *VolumeReference) validateDiskType(formats strfmt.Registry) error { return nil } +func (m *VolumeReference) validateFreezeTime(formats strfmt.Registry) error { + if swag.IsZero(m.FreezeTime) { // not required + return nil + } + + if err := validate.FormatOf("freezeTime", "body", "date-time", m.FreezeTime.String(), formats); err != nil { + return err + } + + return nil +} + func (m *VolumeReference) validateHref(formats strfmt.Registry) error { if err := validate.Required("href", "body", m.Href); err != nil { @@ -311,6 +362,23 @@ func (m *VolumeReference) validateState(formats strfmt.Registry) error { return nil } +func (m *VolumeReference) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + func (m *VolumeReference) validateVolumeID(formats strfmt.Registry) error { if err := validate.Required("volumeID", "body", m.VolumeID); err != nil { @@ -329,8 +397,53 @@ func (m *VolumeReference) validateWwn(formats strfmt.Registry) error { return nil } -// ContextValidate validates this volume reference based on context it is used +// ContextValidate validate this volume reference based on the context it is used func (m *VolumeReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumeReference) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + +func (m *VolumeReference) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } 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 +} diff --git a/power/models/volumes_clone_async_request.go b/power/models/volumes_clone_async_request.go index 1b0993a1..6d9f8c3b 100644 --- a/power/models/volumes_clone_async_request.go +++ b/power/models/volumes_clone_async_request.go @@ -40,6 +40,9 @@ type VolumesCloneAsyncRequest struct { // TargetStorageTier string `json:"targetStorageTier,omitempty"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // List of volumes to be cloned // Required: true VolumeIDs []string `json:"volumeIDs"` @@ -53,6 +56,10 @@ func (m *VolumesCloneAsyncRequest) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if err := m.validateVolumeIDs(formats); err != nil { res = append(res, err) } @@ -72,6 +79,23 @@ func (m *VolumesCloneAsyncRequest) validateName(formats strfmt.Registry) error { return nil } +func (m *VolumesCloneAsyncRequest) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + func (m *VolumesCloneAsyncRequest) validateVolumeIDs(formats strfmt.Registry) error { if err := validate.Required("volumeIDs", "body", m.VolumeIDs); err != nil { @@ -81,8 +105,31 @@ func (m *VolumesCloneAsyncRequest) validateVolumeIDs(formats strfmt.Registry) er return nil } -// ContextValidate validates this volumes clone async request based on context it is used +// ContextValidate validate this volumes clone async request based on the context it is used func (m *VolumesCloneAsyncRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumesCloneAsyncRequest) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } diff --git a/power/models/volumes_clone_execute.go b/power/models/volumes_clone_execute.go index b470cb78..e118ea23 100644 --- a/power/models/volumes_clone_execute.go +++ b/power/models/volumes_clone_execute.go @@ -44,6 +44,9 @@ type VolumesCloneExecute struct { // the source volumes. // TargetStorageTier string `json:"targetStorageTier,omitempty"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this volumes clone execute @@ -54,6 +57,10 @@ func (m *VolumesCloneExecute) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -69,8 +76,48 @@ func (m *VolumesCloneExecute) validateName(formats strfmt.Registry) error { return nil } -// ContextValidate validates this volumes clone execute based on context it is used +func (m *VolumesCloneExecute) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + +// ContextValidate validate this volumes clone execute based on the context it is used func (m *VolumesCloneExecute) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumesCloneExecute) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil }