diff --git a/power/client/p_cloud_images/pcloud_v2_images_export_post_responses.go b/power/client/p_cloud_images/pcloud_v2_images_export_post_responses.go index 80ba815b..1778c794 100644 --- a/power/client/p_cloud_images/pcloud_v2_images_export_post_responses.go +++ b/power/client/p_cloud_images/pcloud_v2_images_export_post_responses.go @@ -356,7 +356,7 @@ func NewPcloudV2ImagesExportPostNotFound() *PcloudV2ImagesExportPostNotFound { /* PcloudV2ImagesExportPostNotFound describes a response with status code 404, with default header values. -image id not found +Not Found */ type PcloudV2ImagesExportPostNotFound struct { Payload *models.Error diff --git a/power/client/power_edge_router/power_edge_router_client.go b/power/client/power_edge_router/power_edge_router_client.go new file mode 100644 index 00000000..bf6c3505 --- /dev/null +++ b/power/client/power_edge_router/power_edge_router_client.go @@ -0,0 +1,80 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package power_edge_router + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new power edge router API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for power edge router API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + V1PoweredgerouterActionPost(params *V1PoweredgerouterActionPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1PoweredgerouterActionPostOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +V1PoweredgerouterActionPost performs an power edge router action migrate start migrate validate on a workspace +*/ +func (a *Client) V1PoweredgerouterActionPost(params *V1PoweredgerouterActionPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1PoweredgerouterActionPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1PoweredgerouterActionPostParams() + } + op := &runtime.ClientOperation{ + ID: "v1.poweredgerouter.action.post", + Method: "POST", + PathPattern: "/v1/workspaces/{workspace_id}/power-edge-router/action", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1PoweredgerouterActionPostReader{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.(*V1PoweredgerouterActionPostOK) + 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.poweredgerouter.action.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/power/client/power_edge_router/v1_poweredgerouter_action_post_parameters.go b/power/client/power_edge_router/v1_poweredgerouter_action_post_parameters.go new file mode 100644 index 00000000..3a945a3c --- /dev/null +++ b/power/client/power_edge_router/v1_poweredgerouter_action_post_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package power_edge_router + +// 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" +) + +// NewV1PoweredgerouterActionPostParams creates a new V1PoweredgerouterActionPostParams 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 NewV1PoweredgerouterActionPostParams() *V1PoweredgerouterActionPostParams { + return &V1PoweredgerouterActionPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1PoweredgerouterActionPostParamsWithTimeout creates a new V1PoweredgerouterActionPostParams object +// with the ability to set a timeout on a request. +func NewV1PoweredgerouterActionPostParamsWithTimeout(timeout time.Duration) *V1PoweredgerouterActionPostParams { + return &V1PoweredgerouterActionPostParams{ + timeout: timeout, + } +} + +// NewV1PoweredgerouterActionPostParamsWithContext creates a new V1PoweredgerouterActionPostParams object +// with the ability to set a context for a request. +func NewV1PoweredgerouterActionPostParamsWithContext(ctx context.Context) *V1PoweredgerouterActionPostParams { + return &V1PoweredgerouterActionPostParams{ + Context: ctx, + } +} + +// NewV1PoweredgerouterActionPostParamsWithHTTPClient creates a new V1PoweredgerouterActionPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1PoweredgerouterActionPostParamsWithHTTPClient(client *http.Client) *V1PoweredgerouterActionPostParams { + return &V1PoweredgerouterActionPostParams{ + HTTPClient: client, + } +} + +/* +V1PoweredgerouterActionPostParams contains all the parameters to send to the API endpoint + + for the v1 poweredgerouter action post operation. + + Typically these are written to a http.Request. +*/ +type V1PoweredgerouterActionPostParams struct { + + /* Body. + + Parameters for the desired action + */ + Body *models.PowerEdgeRouterAction + + /* WorkspaceID. + + Workspace ID + */ + WorkspaceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 poweredgerouter action post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1PoweredgerouterActionPostParams) WithDefaults() *V1PoweredgerouterActionPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 poweredgerouter action post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1PoweredgerouterActionPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 poweredgerouter action post params +func (o *V1PoweredgerouterActionPostParams) WithTimeout(timeout time.Duration) *V1PoweredgerouterActionPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 poweredgerouter action post params +func (o *V1PoweredgerouterActionPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 poweredgerouter action post params +func (o *V1PoweredgerouterActionPostParams) WithContext(ctx context.Context) *V1PoweredgerouterActionPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 poweredgerouter action post params +func (o *V1PoweredgerouterActionPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 poweredgerouter action post params +func (o *V1PoweredgerouterActionPostParams) WithHTTPClient(client *http.Client) *V1PoweredgerouterActionPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 poweredgerouter action post params +func (o *V1PoweredgerouterActionPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 poweredgerouter action post params +func (o *V1PoweredgerouterActionPostParams) WithBody(body *models.PowerEdgeRouterAction) *V1PoweredgerouterActionPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 poweredgerouter action post params +func (o *V1PoweredgerouterActionPostParams) SetBody(body *models.PowerEdgeRouterAction) { + o.Body = body +} + +// WithWorkspaceID adds the workspaceID to the v1 poweredgerouter action post params +func (o *V1PoweredgerouterActionPostParams) WithWorkspaceID(workspaceID string) *V1PoweredgerouterActionPostParams { + o.SetWorkspaceID(workspaceID) + return o +} + +// SetWorkspaceID adds the workspaceId to the v1 poweredgerouter action post params +func (o *V1PoweredgerouterActionPostParams) SetWorkspaceID(workspaceID string) { + o.WorkspaceID = workspaceID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1PoweredgerouterActionPostParams) 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 workspace_id + if err := r.SetPathParam("workspace_id", o.WorkspaceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/power_edge_router/v1_poweredgerouter_action_post_responses.go b/power/client/power_edge_router/v1_poweredgerouter_action_post_responses.go new file mode 100644 index 00000000..8dfd54fb --- /dev/null +++ b/power/client/power_edge_router/v1_poweredgerouter_action_post_responses.go @@ -0,0 +1,545 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package power_edge_router + +// 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" +) + +// V1PoweredgerouterActionPostReader is a Reader for the V1PoweredgerouterActionPost structure. +type V1PoweredgerouterActionPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1PoweredgerouterActionPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1PoweredgerouterActionPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1PoweredgerouterActionPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1PoweredgerouterActionPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1PoweredgerouterActionPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1PoweredgerouterActionPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1PoweredgerouterActionPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1PoweredgerouterActionPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /v1/workspaces/{workspace_id}/power-edge-router/action] v1.poweredgerouter.action.post", response, response.Code()) + } +} + +// NewV1PoweredgerouterActionPostOK creates a V1PoweredgerouterActionPostOK with default headers values +func NewV1PoweredgerouterActionPostOK() *V1PoweredgerouterActionPostOK { + return &V1PoweredgerouterActionPostOK{} +} + +/* +V1PoweredgerouterActionPostOK describes a response with status code 200, with default header values. + +OK +*/ +type V1PoweredgerouterActionPostOK struct { + Payload models.Object +} + +// IsSuccess returns true when this v1 poweredgerouter action post o k response has a 2xx status code +func (o *V1PoweredgerouterActionPostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 poweredgerouter action post o k response has a 3xx status code +func (o *V1PoweredgerouterActionPostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 poweredgerouter action post o k response has a 4xx status code +func (o *V1PoweredgerouterActionPostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 poweredgerouter action post o k response has a 5xx status code +func (o *V1PoweredgerouterActionPostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 poweredgerouter action post o k response a status code equal to that given +func (o *V1PoweredgerouterActionPostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 poweredgerouter action post o k response +func (o *V1PoweredgerouterActionPostOK) Code() int { + return 200 +} + +func (o *V1PoweredgerouterActionPostOK) Error() string { + return fmt.Sprintf("[POST /v1/workspaces/{workspace_id}/power-edge-router/action][%d] v1PoweredgerouterActionPostOK %+v", 200, o.Payload) +} + +func (o *V1PoweredgerouterActionPostOK) String() string { + return fmt.Sprintf("[POST /v1/workspaces/{workspace_id}/power-edge-router/action][%d] v1PoweredgerouterActionPostOK %+v", 200, o.Payload) +} + +func (o *V1PoweredgerouterActionPostOK) GetPayload() models.Object { + return o.Payload +} + +func (o *V1PoweredgerouterActionPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1PoweredgerouterActionPostBadRequest creates a V1PoweredgerouterActionPostBadRequest with default headers values +func NewV1PoweredgerouterActionPostBadRequest() *V1PoweredgerouterActionPostBadRequest { + return &V1PoweredgerouterActionPostBadRequest{} +} + +/* +V1PoweredgerouterActionPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1PoweredgerouterActionPostBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 poweredgerouter action post bad request response has a 2xx status code +func (o *V1PoweredgerouterActionPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 poweredgerouter action post bad request response has a 3xx status code +func (o *V1PoweredgerouterActionPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 poweredgerouter action post bad request response has a 4xx status code +func (o *V1PoweredgerouterActionPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 poweredgerouter action post bad request response has a 5xx status code +func (o *V1PoweredgerouterActionPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 poweredgerouter action post bad request response a status code equal to that given +func (o *V1PoweredgerouterActionPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 poweredgerouter action post bad request response +func (o *V1PoweredgerouterActionPostBadRequest) Code() int { + return 400 +} + +func (o *V1PoweredgerouterActionPostBadRequest) Error() string { + return fmt.Sprintf("[POST /v1/workspaces/{workspace_id}/power-edge-router/action][%d] v1PoweredgerouterActionPostBadRequest %+v", 400, o.Payload) +} + +func (o *V1PoweredgerouterActionPostBadRequest) String() string { + return fmt.Sprintf("[POST /v1/workspaces/{workspace_id}/power-edge-router/action][%d] v1PoweredgerouterActionPostBadRequest %+v", 400, o.Payload) +} + +func (o *V1PoweredgerouterActionPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1PoweredgerouterActionPostBadRequest) 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 +} + +// NewV1PoweredgerouterActionPostUnauthorized creates a V1PoweredgerouterActionPostUnauthorized with default headers values +func NewV1PoweredgerouterActionPostUnauthorized() *V1PoweredgerouterActionPostUnauthorized { + return &V1PoweredgerouterActionPostUnauthorized{} +} + +/* +V1PoweredgerouterActionPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1PoweredgerouterActionPostUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 poweredgerouter action post unauthorized response has a 2xx status code +func (o *V1PoweredgerouterActionPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 poweredgerouter action post unauthorized response has a 3xx status code +func (o *V1PoweredgerouterActionPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 poweredgerouter action post unauthorized response has a 4xx status code +func (o *V1PoweredgerouterActionPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 poweredgerouter action post unauthorized response has a 5xx status code +func (o *V1PoweredgerouterActionPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 poweredgerouter action post unauthorized response a status code equal to that given +func (o *V1PoweredgerouterActionPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 poweredgerouter action post unauthorized response +func (o *V1PoweredgerouterActionPostUnauthorized) Code() int { + return 401 +} + +func (o *V1PoweredgerouterActionPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /v1/workspaces/{workspace_id}/power-edge-router/action][%d] v1PoweredgerouterActionPostUnauthorized %+v", 401, o.Payload) +} + +func (o *V1PoweredgerouterActionPostUnauthorized) String() string { + return fmt.Sprintf("[POST /v1/workspaces/{workspace_id}/power-edge-router/action][%d] v1PoweredgerouterActionPostUnauthorized %+v", 401, o.Payload) +} + +func (o *V1PoweredgerouterActionPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1PoweredgerouterActionPostUnauthorized) 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 +} + +// NewV1PoweredgerouterActionPostForbidden creates a V1PoweredgerouterActionPostForbidden with default headers values +func NewV1PoweredgerouterActionPostForbidden() *V1PoweredgerouterActionPostForbidden { + return &V1PoweredgerouterActionPostForbidden{} +} + +/* +V1PoweredgerouterActionPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1PoweredgerouterActionPostForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 poweredgerouter action post forbidden response has a 2xx status code +func (o *V1PoweredgerouterActionPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 poweredgerouter action post forbidden response has a 3xx status code +func (o *V1PoweredgerouterActionPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 poweredgerouter action post forbidden response has a 4xx status code +func (o *V1PoweredgerouterActionPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 poweredgerouter action post forbidden response has a 5xx status code +func (o *V1PoweredgerouterActionPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 poweredgerouter action post forbidden response a status code equal to that given +func (o *V1PoweredgerouterActionPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 poweredgerouter action post forbidden response +func (o *V1PoweredgerouterActionPostForbidden) Code() int { + return 403 +} + +func (o *V1PoweredgerouterActionPostForbidden) Error() string { + return fmt.Sprintf("[POST /v1/workspaces/{workspace_id}/power-edge-router/action][%d] v1PoweredgerouterActionPostForbidden %+v", 403, o.Payload) +} + +func (o *V1PoweredgerouterActionPostForbidden) String() string { + return fmt.Sprintf("[POST /v1/workspaces/{workspace_id}/power-edge-router/action][%d] v1PoweredgerouterActionPostForbidden %+v", 403, o.Payload) +} + +func (o *V1PoweredgerouterActionPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1PoweredgerouterActionPostForbidden) 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 +} + +// NewV1PoweredgerouterActionPostNotFound creates a V1PoweredgerouterActionPostNotFound with default headers values +func NewV1PoweredgerouterActionPostNotFound() *V1PoweredgerouterActionPostNotFound { + return &V1PoweredgerouterActionPostNotFound{} +} + +/* +V1PoweredgerouterActionPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1PoweredgerouterActionPostNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 poweredgerouter action post not found response has a 2xx status code +func (o *V1PoweredgerouterActionPostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 poweredgerouter action post not found response has a 3xx status code +func (o *V1PoweredgerouterActionPostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 poweredgerouter action post not found response has a 4xx status code +func (o *V1PoweredgerouterActionPostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 poweredgerouter action post not found response has a 5xx status code +func (o *V1PoweredgerouterActionPostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 poweredgerouter action post not found response a status code equal to that given +func (o *V1PoweredgerouterActionPostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 poweredgerouter action post not found response +func (o *V1PoweredgerouterActionPostNotFound) Code() int { + return 404 +} + +func (o *V1PoweredgerouterActionPostNotFound) Error() string { + return fmt.Sprintf("[POST /v1/workspaces/{workspace_id}/power-edge-router/action][%d] v1PoweredgerouterActionPostNotFound %+v", 404, o.Payload) +} + +func (o *V1PoweredgerouterActionPostNotFound) String() string { + return fmt.Sprintf("[POST /v1/workspaces/{workspace_id}/power-edge-router/action][%d] v1PoweredgerouterActionPostNotFound %+v", 404, o.Payload) +} + +func (o *V1PoweredgerouterActionPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1PoweredgerouterActionPostNotFound) 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 +} + +// NewV1PoweredgerouterActionPostConflict creates a V1PoweredgerouterActionPostConflict with default headers values +func NewV1PoweredgerouterActionPostConflict() *V1PoweredgerouterActionPostConflict { + return &V1PoweredgerouterActionPostConflict{} +} + +/* +V1PoweredgerouterActionPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1PoweredgerouterActionPostConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 poweredgerouter action post conflict response has a 2xx status code +func (o *V1PoweredgerouterActionPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 poweredgerouter action post conflict response has a 3xx status code +func (o *V1PoweredgerouterActionPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 poweredgerouter action post conflict response has a 4xx status code +func (o *V1PoweredgerouterActionPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 poweredgerouter action post conflict response has a 5xx status code +func (o *V1PoweredgerouterActionPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 poweredgerouter action post conflict response a status code equal to that given +func (o *V1PoweredgerouterActionPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 poweredgerouter action post conflict response +func (o *V1PoweredgerouterActionPostConflict) Code() int { + return 409 +} + +func (o *V1PoweredgerouterActionPostConflict) Error() string { + return fmt.Sprintf("[POST /v1/workspaces/{workspace_id}/power-edge-router/action][%d] v1PoweredgerouterActionPostConflict %+v", 409, o.Payload) +} + +func (o *V1PoweredgerouterActionPostConflict) String() string { + return fmt.Sprintf("[POST /v1/workspaces/{workspace_id}/power-edge-router/action][%d] v1PoweredgerouterActionPostConflict %+v", 409, o.Payload) +} + +func (o *V1PoweredgerouterActionPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1PoweredgerouterActionPostConflict) 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 +} + +// NewV1PoweredgerouterActionPostInternalServerError creates a V1PoweredgerouterActionPostInternalServerError with default headers values +func NewV1PoweredgerouterActionPostInternalServerError() *V1PoweredgerouterActionPostInternalServerError { + return &V1PoweredgerouterActionPostInternalServerError{} +} + +/* +V1PoweredgerouterActionPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1PoweredgerouterActionPostInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 poweredgerouter action post internal server error response has a 2xx status code +func (o *V1PoweredgerouterActionPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 poweredgerouter action post internal server error response has a 3xx status code +func (o *V1PoweredgerouterActionPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 poweredgerouter action post internal server error response has a 4xx status code +func (o *V1PoweredgerouterActionPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 poweredgerouter action post internal server error response has a 5xx status code +func (o *V1PoweredgerouterActionPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 poweredgerouter action post internal server error response a status code equal to that given +func (o *V1PoweredgerouterActionPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 poweredgerouter action post internal server error response +func (o *V1PoweredgerouterActionPostInternalServerError) Code() int { + return 500 +} + +func (o *V1PoweredgerouterActionPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /v1/workspaces/{workspace_id}/power-edge-router/action][%d] v1PoweredgerouterActionPostInternalServerError %+v", 500, o.Payload) +} + +func (o *V1PoweredgerouterActionPostInternalServerError) String() string { + return fmt.Sprintf("[POST /v1/workspaces/{workspace_id}/power-edge-router/action][%d] v1PoweredgerouterActionPostInternalServerError %+v", 500, o.Payload) +} + +func (o *V1PoweredgerouterActionPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1PoweredgerouterActionPostInternalServerError) 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/power_iaas_api_client.go b/power/client/power_iaas_api_client.go index fe13576c..cbd707d0 100644 --- a/power/client/power_iaas_api_client.go +++ b/power/client/power_iaas_api_client.go @@ -48,6 +48,7 @@ import ( "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volume_groups" "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volume_onboarding" "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes" + "github.com/IBM-Cloud/power-go-client/power/client/power_edge_router" "github.com/IBM-Cloud/power-go-client/power/client/service_bindings" "github.com/IBM-Cloud/power-go-client/power/client/service_instances" "github.com/IBM-Cloud/power-go-client/power/client/storage_types" @@ -135,6 +136,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *PowerIaasA cli.PCloudVolumeGroups = p_cloud_volume_groups.New(transport, formats) cli.PCloudVolumeOnboarding = p_cloud_volume_onboarding.New(transport, formats) cli.PCloudVolumes = p_cloud_volumes.New(transport, formats) + cli.PowerEdgeRouter = power_edge_router.New(transport, formats) cli.ServiceBindings = service_bindings.New(transport, formats) cli.ServiceInstances = service_instances.New(transport, formats) cli.StorageTypes = storage_types.New(transport, formats) @@ -260,6 +262,8 @@ type PowerIaasAPI struct { PCloudVolumes p_cloud_volumes.ClientService + PowerEdgeRouter power_edge_router.ClientService + ServiceBindings service_bindings.ClientService ServiceInstances service_instances.ClientService @@ -314,6 +318,7 @@ func (c *PowerIaasAPI) SetTransport(transport runtime.ClientTransport) { c.PCloudVolumeGroups.SetTransport(transport) c.PCloudVolumeOnboarding.SetTransport(transport) c.PCloudVolumes.SetTransport(transport) + c.PowerEdgeRouter.SetTransport(transport) c.ServiceBindings.SetTransport(transport) c.ServiceInstances.SetTransport(transport) c.StorageTypes.SetTransport(transport) diff --git a/power/models/power_edge_router_action.go b/power/models/power_edge_router_action.go new file mode 100644 index 00000000..ed427705 --- /dev/null +++ b/power/models/power_edge_router_action.go @@ -0,0 +1,107 @@ +// 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" +) + +// PowerEdgeRouterAction power edge router action +// +// swagger:model PowerEdgeRouterAction +type PowerEdgeRouterAction struct { + + // Name of the action to take; can be migrate-start, migrate-validate + // Required: true + // Enum: [migrate-start migrate-validate] + Action *string `json:"action"` +} + +// Validate validates this power edge router action +func (m *PowerEdgeRouterAction) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAction(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var powerEdgeRouterActionTypeActionPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["migrate-start","migrate-validate"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + powerEdgeRouterActionTypeActionPropEnum = append(powerEdgeRouterActionTypeActionPropEnum, v) + } +} + +const ( + + // PowerEdgeRouterActionActionMigrateDashStart captures enum value "migrate-start" + PowerEdgeRouterActionActionMigrateDashStart string = "migrate-start" + + // PowerEdgeRouterActionActionMigrateDashValidate captures enum value "migrate-validate" + PowerEdgeRouterActionActionMigrateDashValidate string = "migrate-validate" +) + +// prop value enum +func (m *PowerEdgeRouterAction) validateActionEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, powerEdgeRouterActionTypeActionPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *PowerEdgeRouterAction) validateAction(formats strfmt.Registry) error { + + if err := validate.Required("action", "body", m.Action); err != nil { + return err + } + + // value enum + if err := m.validateActionEnum("action", "body", *m.Action); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this power edge router action based on context it is used +func (m *PowerEdgeRouterAction) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PowerEdgeRouterAction) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PowerEdgeRouterAction) UnmarshalBinary(b []byte) error { + var res PowerEdgeRouterAction + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +}