From 9863b8d4da5e0c5e5827840dfa0fa115da97c449 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Fri, 13 Oct 2023 11:18:16 -0500 Subject: [PATCH] Update swagger client and models to service-broker v1.129.1 (#253) * Generated Swagger client from service-broker commit bcd3af8fd7d528adcd4986768c116ebf6bb55b97 * Remove authentication from datacenter endpoints --------- Co-authored-by: Axel Ismirlian <ismirlia@us.ibm.com> --- ...i_datacenters.go => ibm-pi-datacenters.go} | 4 +- .../client/datacenters/datacenters_client.go | 10 +- .../v1_workspaces_getall_parameters.go | 128 ++++++ .../v1_workspaces_getall_responses.go | 399 ++++++++++++++++++ power/client/workspaces/workspaces_client.go | 41 ++ power/models/datacenter.go | 19 +- power/models/network_create.go | 13 - power/models/p_vm_instance_create.go | 59 +++ 8 files changed, 644 insertions(+), 29 deletions(-) rename clients/instance/{ibm_pi_datacenters.go => ibm-pi-datacenters.go} (95%) create mode 100644 power/client/workspaces/v1_workspaces_getall_parameters.go create mode 100644 power/client/workspaces/v1_workspaces_getall_responses.go diff --git a/clients/instance/ibm_pi_datacenters.go b/clients/instance/ibm-pi-datacenters.go similarity index 95% rename from clients/instance/ibm_pi_datacenters.go rename to clients/instance/ibm-pi-datacenters.go index c58588ba..c1d31367 100644 --- a/clients/instance/ibm_pi_datacenters.go +++ b/clients/instance/ibm-pi-datacenters.go @@ -27,7 +27,7 @@ func (f *IBMPIDatacentersClient) Get(datacenterRegion string) (*models.Datacente return nil, fmt.Errorf("operation not supported in satellite location, check documentation") } params := datacenters.NewV1DatacentersGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithDatacenterRegion(datacenterRegion) - resp, err := f.session.Power.Datacenters.V1DatacentersGet(params, f.session.AuthInfo(f.cloudInstanceID)) + resp, err := f.session.Power.Datacenters.V1DatacentersGet(params) if err != nil { return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf(errors.GetDatacenterOperationFailed, f.cloudInstanceID, err)) } @@ -42,7 +42,7 @@ func (f *IBMPIDatacentersClient) GetAll() (*models.Datacenters, error) { return nil, fmt.Errorf("operation not supported in satellite location, check documentation") } params := datacenters.NewV1DatacentersGetallParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut) - resp, err := f.session.Power.Datacenters.V1DatacentersGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + resp, err := f.session.Power.Datacenters.V1DatacentersGetall(params) if err != nil { return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get all Datacenters: %w", err)) diff --git a/power/client/datacenters/datacenters_client.go b/power/client/datacenters/datacenters_client.go index 781c8dee..4bde6516 100644 --- a/power/client/datacenters/datacenters_client.go +++ b/power/client/datacenters/datacenters_client.go @@ -30,9 +30,9 @@ type ClientOption func(*runtime.ClientOperation) // ClientService is the interface for Client methods type ClientService interface { - V1DatacentersGet(params *V1DatacentersGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1DatacentersGetOK, error) + V1DatacentersGet(params *V1DatacentersGetParams, opts ...ClientOption) (*V1DatacentersGetOK, error) - V1DatacentersGetall(params *V1DatacentersGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1DatacentersGetallOK, error) + V1DatacentersGetall(params *V1DatacentersGetallParams, opts ...ClientOption) (*V1DatacentersGetallOK, error) SetTransport(transport runtime.ClientTransport) } @@ -40,7 +40,7 @@ type ClientService interface { /* V1DatacentersGet gets a datacenter s information and capabilities */ -func (a *Client) V1DatacentersGet(params *V1DatacentersGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1DatacentersGetOK, error) { +func (a *Client) V1DatacentersGet(params *V1DatacentersGetParams, opts ...ClientOption) (*V1DatacentersGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewV1DatacentersGetParams() @@ -54,7 +54,6 @@ func (a *Client) V1DatacentersGet(params *V1DatacentersGetParams, authInfo runti Schemes: []string{"http"}, Params: params, Reader: &V1DatacentersGetReader{formats: a.formats}, - AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, } @@ -79,7 +78,7 @@ func (a *Client) V1DatacentersGet(params *V1DatacentersGetParams, authInfo runti /* V1DatacentersGetall gets all datacenters information and capabilities */ -func (a *Client) V1DatacentersGetall(params *V1DatacentersGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1DatacentersGetallOK, error) { +func (a *Client) V1DatacentersGetall(params *V1DatacentersGetallParams, opts ...ClientOption) (*V1DatacentersGetallOK, error) { // TODO: Validate the params before sending if params == nil { params = NewV1DatacentersGetallParams() @@ -93,7 +92,6 @@ func (a *Client) V1DatacentersGetall(params *V1DatacentersGetallParams, authInfo Schemes: []string{"http"}, Params: params, Reader: &V1DatacentersGetallReader{formats: a.formats}, - AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, } diff --git a/power/client/workspaces/v1_workspaces_getall_parameters.go b/power/client/workspaces/v1_workspaces_getall_parameters.go new file mode 100644 index 00000000..7e777b84 --- /dev/null +++ b/power/client/workspaces/v1_workspaces_getall_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package workspaces + +// 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" +) + +// NewV1WorkspacesGetallParams creates a new V1WorkspacesGetallParams 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 NewV1WorkspacesGetallParams() *V1WorkspacesGetallParams { + return &V1WorkspacesGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1WorkspacesGetallParamsWithTimeout creates a new V1WorkspacesGetallParams object +// with the ability to set a timeout on a request. +func NewV1WorkspacesGetallParamsWithTimeout(timeout time.Duration) *V1WorkspacesGetallParams { + return &V1WorkspacesGetallParams{ + timeout: timeout, + } +} + +// NewV1WorkspacesGetallParamsWithContext creates a new V1WorkspacesGetallParams object +// with the ability to set a context for a request. +func NewV1WorkspacesGetallParamsWithContext(ctx context.Context) *V1WorkspacesGetallParams { + return &V1WorkspacesGetallParams{ + Context: ctx, + } +} + +// NewV1WorkspacesGetallParamsWithHTTPClient creates a new V1WorkspacesGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1WorkspacesGetallParamsWithHTTPClient(client *http.Client) *V1WorkspacesGetallParams { + return &V1WorkspacesGetallParams{ + HTTPClient: client, + } +} + +/* +V1WorkspacesGetallParams contains all the parameters to send to the API endpoint + + for the v1 workspaces getall operation. + + Typically these are written to a http.Request. +*/ +type V1WorkspacesGetallParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 workspaces getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1WorkspacesGetallParams) WithDefaults() *V1WorkspacesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 workspaces getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1WorkspacesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 workspaces getall params +func (o *V1WorkspacesGetallParams) WithTimeout(timeout time.Duration) *V1WorkspacesGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 workspaces getall params +func (o *V1WorkspacesGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 workspaces getall params +func (o *V1WorkspacesGetallParams) WithContext(ctx context.Context) *V1WorkspacesGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 workspaces getall params +func (o *V1WorkspacesGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 workspaces getall params +func (o *V1WorkspacesGetallParams) WithHTTPClient(client *http.Client) *V1WorkspacesGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 workspaces getall params +func (o *V1WorkspacesGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *V1WorkspacesGetallParams) 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/workspaces/v1_workspaces_getall_responses.go b/power/client/workspaces/v1_workspaces_getall_responses.go new file mode 100644 index 00000000..671dc336 --- /dev/null +++ b/power/client/workspaces/v1_workspaces_getall_responses.go @@ -0,0 +1,399 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package workspaces + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1WorkspacesGetallReader is a Reader for the V1WorkspacesGetall structure. +type V1WorkspacesGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1WorkspacesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1WorkspacesGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewV1WorkspacesGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1WorkspacesGetallForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 429: + result := NewV1WorkspacesGetallTooManyRequests() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1WorkspacesGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/workspaces] v1.workspaces.getall", response, response.Code()) + } +} + +// NewV1WorkspacesGetallOK creates a V1WorkspacesGetallOK with default headers values +func NewV1WorkspacesGetallOK() *V1WorkspacesGetallOK { + return &V1WorkspacesGetallOK{} +} + +/* +V1WorkspacesGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type V1WorkspacesGetallOK struct { + Payload *models.Workspaces +} + +// IsSuccess returns true when this v1 workspaces getall o k response has a 2xx status code +func (o *V1WorkspacesGetallOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 workspaces getall o k response has a 3xx status code +func (o *V1WorkspacesGetallOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 workspaces getall o k response has a 4xx status code +func (o *V1WorkspacesGetallOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 workspaces getall o k response has a 5xx status code +func (o *V1WorkspacesGetallOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 workspaces getall o k response a status code equal to that given +func (o *V1WorkspacesGetallOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 workspaces getall o k response +func (o *V1WorkspacesGetallOK) Code() int { + return 200 +} + +func (o *V1WorkspacesGetallOK) Error() string { + return fmt.Sprintf("[GET /v1/workspaces][%d] v1WorkspacesGetallOK %+v", 200, o.Payload) +} + +func (o *V1WorkspacesGetallOK) String() string { + return fmt.Sprintf("[GET /v1/workspaces][%d] v1WorkspacesGetallOK %+v", 200, o.Payload) +} + +func (o *V1WorkspacesGetallOK) GetPayload() *models.Workspaces { + return o.Payload +} + +func (o *V1WorkspacesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Workspaces) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1WorkspacesGetallUnauthorized creates a V1WorkspacesGetallUnauthorized with default headers values +func NewV1WorkspacesGetallUnauthorized() *V1WorkspacesGetallUnauthorized { + return &V1WorkspacesGetallUnauthorized{} +} + +/* +V1WorkspacesGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1WorkspacesGetallUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 workspaces getall unauthorized response has a 2xx status code +func (o *V1WorkspacesGetallUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 workspaces getall unauthorized response has a 3xx status code +func (o *V1WorkspacesGetallUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 workspaces getall unauthorized response has a 4xx status code +func (o *V1WorkspacesGetallUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 workspaces getall unauthorized response has a 5xx status code +func (o *V1WorkspacesGetallUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 workspaces getall unauthorized response a status code equal to that given +func (o *V1WorkspacesGetallUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 workspaces getall unauthorized response +func (o *V1WorkspacesGetallUnauthorized) Code() int { + return 401 +} + +func (o *V1WorkspacesGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /v1/workspaces][%d] v1WorkspacesGetallUnauthorized %+v", 401, o.Payload) +} + +func (o *V1WorkspacesGetallUnauthorized) String() string { + return fmt.Sprintf("[GET /v1/workspaces][%d] v1WorkspacesGetallUnauthorized %+v", 401, o.Payload) +} + +func (o *V1WorkspacesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1WorkspacesGetallUnauthorized) 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 +} + +// NewV1WorkspacesGetallForbidden creates a V1WorkspacesGetallForbidden with default headers values +func NewV1WorkspacesGetallForbidden() *V1WorkspacesGetallForbidden { + return &V1WorkspacesGetallForbidden{} +} + +/* +V1WorkspacesGetallForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1WorkspacesGetallForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 workspaces getall forbidden response has a 2xx status code +func (o *V1WorkspacesGetallForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 workspaces getall forbidden response has a 3xx status code +func (o *V1WorkspacesGetallForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 workspaces getall forbidden response has a 4xx status code +func (o *V1WorkspacesGetallForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 workspaces getall forbidden response has a 5xx status code +func (o *V1WorkspacesGetallForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 workspaces getall forbidden response a status code equal to that given +func (o *V1WorkspacesGetallForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 workspaces getall forbidden response +func (o *V1WorkspacesGetallForbidden) Code() int { + return 403 +} + +func (o *V1WorkspacesGetallForbidden) Error() string { + return fmt.Sprintf("[GET /v1/workspaces][%d] v1WorkspacesGetallForbidden %+v", 403, o.Payload) +} + +func (o *V1WorkspacesGetallForbidden) String() string { + return fmt.Sprintf("[GET /v1/workspaces][%d] v1WorkspacesGetallForbidden %+v", 403, o.Payload) +} + +func (o *V1WorkspacesGetallForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1WorkspacesGetallForbidden) 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 +} + +// NewV1WorkspacesGetallTooManyRequests creates a V1WorkspacesGetallTooManyRequests with default headers values +func NewV1WorkspacesGetallTooManyRequests() *V1WorkspacesGetallTooManyRequests { + return &V1WorkspacesGetallTooManyRequests{} +} + +/* +V1WorkspacesGetallTooManyRequests describes a response with status code 429, with default header values. + +Too Many Requests +*/ +type V1WorkspacesGetallTooManyRequests struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 workspaces getall too many requests response has a 2xx status code +func (o *V1WorkspacesGetallTooManyRequests) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 workspaces getall too many requests response has a 3xx status code +func (o *V1WorkspacesGetallTooManyRequests) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 workspaces getall too many requests response has a 4xx status code +func (o *V1WorkspacesGetallTooManyRequests) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 workspaces getall too many requests response has a 5xx status code +func (o *V1WorkspacesGetallTooManyRequests) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 workspaces getall too many requests response a status code equal to that given +func (o *V1WorkspacesGetallTooManyRequests) IsCode(code int) bool { + return code == 429 +} + +// Code gets the status code for the v1 workspaces getall too many requests response +func (o *V1WorkspacesGetallTooManyRequests) Code() int { + return 429 +} + +func (o *V1WorkspacesGetallTooManyRequests) Error() string { + return fmt.Sprintf("[GET /v1/workspaces][%d] v1WorkspacesGetallTooManyRequests %+v", 429, o.Payload) +} + +func (o *V1WorkspacesGetallTooManyRequests) String() string { + return fmt.Sprintf("[GET /v1/workspaces][%d] v1WorkspacesGetallTooManyRequests %+v", 429, o.Payload) +} + +func (o *V1WorkspacesGetallTooManyRequests) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1WorkspacesGetallTooManyRequests) 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 +} + +// NewV1WorkspacesGetallInternalServerError creates a V1WorkspacesGetallInternalServerError with default headers values +func NewV1WorkspacesGetallInternalServerError() *V1WorkspacesGetallInternalServerError { + return &V1WorkspacesGetallInternalServerError{} +} + +/* +V1WorkspacesGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1WorkspacesGetallInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 workspaces getall internal server error response has a 2xx status code +func (o *V1WorkspacesGetallInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 workspaces getall internal server error response has a 3xx status code +func (o *V1WorkspacesGetallInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 workspaces getall internal server error response has a 4xx status code +func (o *V1WorkspacesGetallInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 workspaces getall internal server error response has a 5xx status code +func (o *V1WorkspacesGetallInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 workspaces getall internal server error response a status code equal to that given +func (o *V1WorkspacesGetallInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 workspaces getall internal server error response +func (o *V1WorkspacesGetallInternalServerError) Code() int { + return 500 +} + +func (o *V1WorkspacesGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /v1/workspaces][%d] v1WorkspacesGetallInternalServerError %+v", 500, o.Payload) +} + +func (o *V1WorkspacesGetallInternalServerError) String() string { + return fmt.Sprintf("[GET /v1/workspaces][%d] v1WorkspacesGetallInternalServerError %+v", 500, o.Payload) +} + +func (o *V1WorkspacesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1WorkspacesGetallInternalServerError) 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/workspaces/workspaces_client.go b/power/client/workspaces/workspaces_client.go index 0ea4e0aa..4929b695 100644 --- a/power/client/workspaces/workspaces_client.go +++ b/power/client/workspaces/workspaces_client.go @@ -32,6 +32,8 @@ type ClientOption func(*runtime.ClientOperation) type ClientService interface { V1WorkspacesGet(params *V1WorkspacesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1WorkspacesGetOK, error) + V1WorkspacesGetall(params *V1WorkspacesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1WorkspacesGetallOK, error) + SetTransport(transport runtime.ClientTransport) } @@ -74,6 +76,45 @@ func (a *Client) V1WorkspacesGet(params *V1WorkspacesGetParams, authInfo runtime panic(msg) } +/* +V1WorkspacesGetall gets all workspaces information and capabilities for a tenant +*/ +func (a *Client) V1WorkspacesGetall(params *V1WorkspacesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1WorkspacesGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1WorkspacesGetallParams() + } + op := &runtime.ClientOperation{ + ID: "v1.workspaces.getall", + Method: "GET", + PathPattern: "/v1/workspaces", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1WorkspacesGetallReader{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.(*V1WorkspacesGetallOK) + 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.workspaces.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/models/datacenter.go b/power/models/datacenter.go index b991d370..d32f9f87 100644 --- a/power/models/datacenter.go +++ b/power/models/datacenter.go @@ -24,13 +24,16 @@ type Datacenter struct { // Required: true Capabilities map[string]bool `json:"capabilities"` + // Link to Datacenter Region + Href string `json:"href,omitempty"` + // The Datacenter location // Required: true Location *DatacenterLocation `json:"location"` // The Datacenter status // Required: true - // Enum: [ACTIVE MAINTENENCE DOWN] + // Enum: [Active Maintenance Down] Status *string `json:"status"` // The Datacenter type @@ -98,7 +101,7 @@ var datacenterTypeStatusPropEnum []interface{} func init() { var res []string - if err := json.Unmarshal([]byte(`["ACTIVE","MAINTENENCE","DOWN"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["Active","Maintenance","Down"]`), &res); err != nil { panic(err) } for _, v := range res { @@ -108,14 +111,14 @@ func init() { const ( - // DatacenterStatusACTIVE captures enum value "ACTIVE" - DatacenterStatusACTIVE string = "ACTIVE" + // DatacenterStatusActive captures enum value "Active" + DatacenterStatusActive string = "Active" - // DatacenterStatusMAINTENENCE captures enum value "MAINTENENCE" - DatacenterStatusMAINTENENCE string = "MAINTENENCE" + // DatacenterStatusMaintenance captures enum value "Maintenance" + DatacenterStatusMaintenance string = "Maintenance" - // DatacenterStatusDOWN captures enum value "DOWN" - DatacenterStatusDOWN string = "DOWN" + // DatacenterStatusDown captures enum value "Down" + DatacenterStatusDown string = "Down" ) // prop value enum diff --git a/power/models/network_create.go b/power/models/network_create.go index d0c06040..d045895b 100644 --- a/power/models/network_create.go +++ b/power/models/network_create.go @@ -55,19 +55,6 @@ type NetworkCreate struct { Type *string `json:"type"` } -func (m *NetworkCreate) UnmarshalJSON(b []byte) error { - type NetworkCreateAlias NetworkCreate - var t NetworkCreateAlias - if err := json.Unmarshal([]byte("{\"accessConfig\":\"internal-only\",\"mtu\":1450}"), &t); err != nil { - return err - } - if err := json.Unmarshal(b, &t); err != nil { - return err - } - *m = NetworkCreate(t) - return nil -} - // Validate validates this network create func (m *NetworkCreate) Validate(formats strfmt.Registry) error { var res []error diff --git a/power/models/p_vm_instance_create.go b/power/models/p_vm_instance_create.go index 5404989b..c439514a 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 cloudInit should be configured or not + ConfigureCloudInit *bool `json:"configureCloudInit,omitempty"` + // The custom deployment type DeploymentType string `json:"deploymentType,omitempty"` @@ -47,6 +50,10 @@ type PVMInstanceCreate struct { // The pvm instance networks information Networks []*PVMInstanceAddNetwork `json:"networks"` + // The type of OS. iamgeID and osType are mutually exclusive. If OStype is provided then VM will be created without any volume and user later can attach primary boot volume. + // Enum: [aix ibmi rhel sles] + OsType string `json:"osType,omitempty"` + // pin policy PinPolicy PinPolicy `json:"pinPolicy,omitempty"` @@ -125,6 +132,10 @@ func (m *PVMInstanceCreate) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateOsType(formats); err != nil { + res = append(res, err) + } + if err := m.validatePinPolicy(formats); err != nil { res = append(res, err) } @@ -215,6 +226,54 @@ func (m *PVMInstanceCreate) validateNetworks(formats strfmt.Registry) error { return nil } +var pVmInstanceCreateTypeOsTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["aix","ibmi","rhel","sles"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + pVmInstanceCreateTypeOsTypePropEnum = append(pVmInstanceCreateTypeOsTypePropEnum, v) + } +} + +const ( + + // PVMInstanceCreateOsTypeAix captures enum value "aix" + PVMInstanceCreateOsTypeAix string = "aix" + + // PVMInstanceCreateOsTypeIbmi captures enum value "ibmi" + PVMInstanceCreateOsTypeIbmi string = "ibmi" + + // PVMInstanceCreateOsTypeRhel captures enum value "rhel" + PVMInstanceCreateOsTypeRhel string = "rhel" + + // PVMInstanceCreateOsTypeSles captures enum value "sles" + PVMInstanceCreateOsTypeSles string = "sles" +) + +// prop value enum +func (m *PVMInstanceCreate) validateOsTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, pVmInstanceCreateTypeOsTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *PVMInstanceCreate) validateOsType(formats strfmt.Registry) error { + if swag.IsZero(m.OsType) { // not required + return nil + } + + // value enum + if err := m.validateOsTypeEnum("osType", "body", m.OsType); err != nil { + return err + } + + return nil +} + func (m *PVMInstanceCreate) validatePinPolicy(formats strfmt.Registry) error { if swag.IsZero(m.PinPolicy) { // not required return nil