From 7e80bcc3e1721154a4be5fc927bc54a500e65bf0 Mon Sep 17 00:00:00 2001 From: powervs-ibm Date: Fri, 14 Jun 2024 07:06:35 +0000 Subject: [PATCH] Generated Swagger client from service-broker commit f856adaa7760209889781f329a122db016cc5587 --- .../snapshots/v1_snapshots_get_responses.go | 76 +++++++++++++++++++ .../v1_snapshots_getall_responses.go | 76 +++++++++++++++++++ power/models/site.go | 76 ++++++++++++++++++- power/models/storage_pool_map.go | 53 +++++++++++++ 4 files changed, 280 insertions(+), 1 deletion(-) create mode 100644 power/models/storage_pool_map.go diff --git a/power/client/snapshots/v1_snapshots_get_responses.go b/power/client/snapshots/v1_snapshots_get_responses.go index 576e0c59..ebddf614 100644 --- a/power/client/snapshots/v1_snapshots_get_responses.go +++ b/power/client/snapshots/v1_snapshots_get_responses.go @@ -60,6 +60,12 @@ func (o *V1SnapshotsGetReader) ReadResponse(response runtime.ClientResponse, con return nil, err } return nil, result + case 503: + result := NewV1SnapshotsGetServiceUnavailable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result default: return nil, runtime.NewAPIError("[GET /v1/snapshots/{snapshot_id}] v1.snapshots.get", response, response.Code()) } @@ -484,3 +490,73 @@ func (o *V1SnapshotsGetInternalServerError) readResponse(response runtime.Client return nil } + +// NewV1SnapshotsGetServiceUnavailable creates a V1SnapshotsGetServiceUnavailable with default headers values +func NewV1SnapshotsGetServiceUnavailable() *V1SnapshotsGetServiceUnavailable { + return &V1SnapshotsGetServiceUnavailable{} +} + +/* +V1SnapshotsGetServiceUnavailable describes a response with status code 503, with default header values. + +Service Unavailable +*/ +type V1SnapshotsGetServiceUnavailable struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 snapshots get service unavailable response has a 2xx status code +func (o *V1SnapshotsGetServiceUnavailable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 snapshots get service unavailable response has a 3xx status code +func (o *V1SnapshotsGetServiceUnavailable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 snapshots get service unavailable response has a 4xx status code +func (o *V1SnapshotsGetServiceUnavailable) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 snapshots get service unavailable response has a 5xx status code +func (o *V1SnapshotsGetServiceUnavailable) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 snapshots get service unavailable response a status code equal to that given +func (o *V1SnapshotsGetServiceUnavailable) IsCode(code int) bool { + return code == 503 +} + +// Code gets the status code for the v1 snapshots get service unavailable response +func (o *V1SnapshotsGetServiceUnavailable) Code() int { + return 503 +} + +func (o *V1SnapshotsGetServiceUnavailable) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/snapshots/{snapshot_id}][%d] v1SnapshotsGetServiceUnavailable %s", 503, payload) +} + +func (o *V1SnapshotsGetServiceUnavailable) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/snapshots/{snapshot_id}][%d] v1SnapshotsGetServiceUnavailable %s", 503, payload) +} + +func (o *V1SnapshotsGetServiceUnavailable) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1SnapshotsGetServiceUnavailable) 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_snapshots_getall_responses.go b/power/client/snapshots/v1_snapshots_getall_responses.go index 36b8f3ee..5c4ebf06 100644 --- a/power/client/snapshots/v1_snapshots_getall_responses.go +++ b/power/client/snapshots/v1_snapshots_getall_responses.go @@ -54,6 +54,12 @@ func (o *V1SnapshotsGetallReader) ReadResponse(response runtime.ClientResponse, return nil, err } return nil, result + case 503: + result := NewV1SnapshotsGetallServiceUnavailable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result default: return nil, runtime.NewAPIError("[GET /v1/snapshots] v1.snapshots.getall", response, response.Code()) } @@ -408,3 +414,73 @@ func (o *V1SnapshotsGetallInternalServerError) readResponse(response runtime.Cli return nil } + +// NewV1SnapshotsGetallServiceUnavailable creates a V1SnapshotsGetallServiceUnavailable with default headers values +func NewV1SnapshotsGetallServiceUnavailable() *V1SnapshotsGetallServiceUnavailable { + return &V1SnapshotsGetallServiceUnavailable{} +} + +/* +V1SnapshotsGetallServiceUnavailable describes a response with status code 503, with default header values. + +Service Unavailable +*/ +type V1SnapshotsGetallServiceUnavailable struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 snapshots getall service unavailable response has a 2xx status code +func (o *V1SnapshotsGetallServiceUnavailable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 snapshots getall service unavailable response has a 3xx status code +func (o *V1SnapshotsGetallServiceUnavailable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 snapshots getall service unavailable response has a 4xx status code +func (o *V1SnapshotsGetallServiceUnavailable) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 snapshots getall service unavailable response has a 5xx status code +func (o *V1SnapshotsGetallServiceUnavailable) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 snapshots getall service unavailable response a status code equal to that given +func (o *V1SnapshotsGetallServiceUnavailable) IsCode(code int) bool { + return code == 503 +} + +// Code gets the status code for the v1 snapshots getall service unavailable response +func (o *V1SnapshotsGetallServiceUnavailable) Code() int { + return 503 +} + +func (o *V1SnapshotsGetallServiceUnavailable) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/snapshots][%d] v1SnapshotsGetallServiceUnavailable %s", 503, payload) +} + +func (o *V1SnapshotsGetallServiceUnavailable) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/snapshots][%d] v1SnapshotsGetallServiceUnavailable %s", 503, payload) +} + +func (o *V1SnapshotsGetallServiceUnavailable) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1SnapshotsGetallServiceUnavailable) 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/site.go b/power/models/site.go index e6523f50..2a9caa29 100644 --- a/power/models/site.go +++ b/power/models/site.go @@ -7,7 +7,9 @@ package models import ( "context" + "strconv" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -17,6 +19,9 @@ import ( // swagger:model Site type Site struct { + // replication pool map + ReplicationPoolMap []*StoragePoolMap `json:"ReplicationPoolMap,omitempty"` + // true if location is active , otherwise it is false IsActive bool `json:"isActive,omitempty"` @@ -26,11 +31,80 @@ type Site struct { // Validate validates this site func (m *Site) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateReplicationPoolMap(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Site) validateReplicationPoolMap(formats strfmt.Registry) error { + if swag.IsZero(m.ReplicationPoolMap) { // not required + return nil + } + + for i := 0; i < len(m.ReplicationPoolMap); i++ { + if swag.IsZero(m.ReplicationPoolMap[i]) { // not required + continue + } + + if m.ReplicationPoolMap[i] != nil { + if err := m.ReplicationPoolMap[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ReplicationPoolMap" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ReplicationPoolMap" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + return nil } -// ContextValidate validates this site based on context it is used +// ContextValidate validate this site based on the context it is used func (m *Site) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateReplicationPoolMap(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Site) contextValidateReplicationPoolMap(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.ReplicationPoolMap); i++ { + + if m.ReplicationPoolMap[i] != nil { + + if swag.IsZero(m.ReplicationPoolMap[i]) { // not required + return nil + } + + if err := m.ReplicationPoolMap[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ReplicationPoolMap" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ReplicationPoolMap" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + return nil } diff --git a/power/models/storage_pool_map.go b/power/models/storage_pool_map.go new file mode 100644 index 00000000..d42b5209 --- /dev/null +++ b/power/models/storage_pool_map.go @@ -0,0 +1,53 @@ +// 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" + "github.com/go-openapi/swag" +) + +// StoragePoolMap storage pool map +// +// swagger:model StoragePoolMap +type StoragePoolMap struct { + + // remote pool + RemotePool string `json:"remotePool,omitempty"` + + // volume pool + VolumePool string `json:"volumePool,omitempty"` +} + +// Validate validates this storage pool map +func (m *StoragePoolMap) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this storage pool map based on context it is used +func (m *StoragePoolMap) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *StoragePoolMap) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *StoragePoolMap) UnmarshalBinary(b []byte) error { + var res StoragePoolMap + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +}