From ef2ef2a570187290b09468d90093fa2fb18b1c6a Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Tue, 16 Jul 2024 12:01:28 -0500 Subject: [PATCH] Generated Swagger client from service-broker commit 35aa4910370044d82d24dad103292b5963600875 (#427) --- .../p_cloud_volumes/p_cloud_volumes_client.go | 41 ++ .../pcloud_v2_volumes_getall_parameters.go | 175 +++++++ .../pcloud_v2_volumes_getall_responses.go | 486 ++++++++++++++++++ power/models/capability_details.go | 157 ++++++ power/models/datacenter.go | 51 ++ power/models/disaster_recovery.go | 108 ++++ power/models/get_bulk_volume.go | 71 +++ power/models/image_specifications.go | 3 + power/models/replication_service.go | 141 +++++ power/models/replication_services.go | 159 ++++++ power/models/replication_target_location.go | 108 ++++ power/models/supported_systems.go | 88 ++++ 12 files changed, 1588 insertions(+) create mode 100644 power/client/p_cloud_volumes/pcloud_v2_volumes_getall_parameters.go create mode 100644 power/client/p_cloud_volumes/pcloud_v2_volumes_getall_responses.go create mode 100644 power/models/capability_details.go create mode 100644 power/models/disaster_recovery.go create mode 100644 power/models/get_bulk_volume.go create mode 100644 power/models/replication_service.go create mode 100644 power/models/replication_services.go create mode 100644 power/models/replication_target_location.go create mode 100644 power/models/supported_systems.go 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/models/capability_details.go b/power/models/capability_details.go new file mode 100644 index 00000000..1b2c0f42 --- /dev/null +++ b/power/models/capability_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" +) + +// CapabilityDetails capability details +// +// swagger:model CapabilityDetails +type CapabilityDetails struct { + + // Disaster Recovery Information + // Required: true + DisasterRecovery *DisasterRecovery `json:"disasterRecovery"` + + // Datacenter System Types Information + // Required: true + SupportedSystems *SupportedSystems `json:"supportedSystems"` +} + +// Validate validates this capability details +func (m *CapabilityDetails) 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 *CapabilityDetails) 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 *CapabilityDetails) 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 capability details based on the context it is used +func (m *CapabilityDetails) 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 *CapabilityDetails) 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 *CapabilityDetails) 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 *CapabilityDetails) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CapabilityDetails) UnmarshalBinary(b []byte) error { + var res CapabilityDetails + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/datacenter.go b/power/models/datacenter.go index 2c33b15c..9fce52be 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 Capability Details + CapabilityDetails *CapabilityDetails `json:"capabilityDetails,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.validateCapabilityDetails(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) validateCapabilityDetails(formats strfmt.Registry) error { + if swag.IsZero(m.CapabilityDetails) { // not required + return nil + } + + if m.CapabilityDetails != nil { + if err := m.CapabilityDetails.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("capabilityDetails") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("capabilityDetails") + } + 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.contextValidateCapabilityDetails(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) contextValidateCapabilityDetails(ctx context.Context, formats strfmt.Registry) error { + + if m.CapabilityDetails != nil { + + if swag.IsZero(m.CapabilityDetails) { // not required + return nil + } + + if err := m.CapabilityDetails.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("capabilityDetails") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("capabilityDetails") + } + return err + } + } + + return nil +} + func (m *Datacenter) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error { if m.Location != nil { diff --git a/power/models/disaster_recovery.go b/power/models/disaster_recovery.go new file mode 100644 index 00000000..852793de --- /dev/null +++ b/power/models/disaster_recovery.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" + + "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 { + + // Disaster Recovery Information + // Required: true + ReplicationServices *ReplicationServices `json:"replicationServices"` +} + +// Validate validates this disaster recovery +func (m *DisasterRecovery) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateReplicationServices(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DisasterRecovery) validateReplicationServices(formats strfmt.Registry) error { + + if err := validate.Required("replicationServices", "body", m.ReplicationServices); err != nil { + return err + } + + if m.ReplicationServices != nil { + if err := m.ReplicationServices.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("replicationServices") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("replicationServices") + } + 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.contextValidateReplicationServices(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DisasterRecovery) contextValidateReplicationServices(ctx context.Context, formats strfmt.Registry) error { + + if m.ReplicationServices != nil { + + if err := m.ReplicationServices.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("replicationServices") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("replicationServices") + } + 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/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/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_services.go b/power/models/replication_services.go new file mode 100644 index 00000000..637125d0 --- /dev/null +++ b/power/models/replication_services.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" +) + +// ReplicationServices replication services +// +// swagger:model ReplicationServices +type ReplicationServices struct { + + // Asynchronous Replication Target Information + // Required: true + AsynchronousReplication *ReplicationService `json:"asynchronousReplication"` + + // Synchronous Replication Target Information + SynchronousReplication *ReplicationService `json:"synchronousReplication,omitempty"` +} + +// Validate validates this replication services +func (m *ReplicationServices) 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 *ReplicationServices) 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 *ReplicationServices) 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 replication services based on the context it is used +func (m *ReplicationServices) 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 *ReplicationServices) 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 *ReplicationServices) 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 *ReplicationServices) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ReplicationServices) UnmarshalBinary(b []byte) error { + var res ReplicationServices + 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/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 +}