From e34df4c920539c2b46b4c0e922a255efec608365 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Tue, 20 Feb 2024 09:32:29 -0600 Subject: [PATCH] Generated Swagger client from service-broker commit 60e0473d56b9d578d8e45469bfa914267b2f7cf6 (#319) Hostgroups changes --- power/client/hostgroups/hostgroups_client.go | 449 +++++++++++++ .../v1_available_hosts_parameters.go | 128 ++++ .../v1_available_hosts_responses.go | 471 +++++++++++++ .../v1_hostgroups_get_parameters.go | 128 ++++ .../hostgroups/v1_hostgroups_get_responses.go | 471 +++++++++++++ .../v1_hostgroups_id_get_parameters.go | 151 +++++ .../v1_hostgroups_id_get_responses.go | 547 +++++++++++++++ .../v1_hostgroups_id_put_parameters.go | 175 +++++ .../v1_hostgroups_id_put_responses.go | 621 ++++++++++++++++++ .../v1_hostgroups_post_parameters.go | 153 +++++ .../v1_hostgroups_post_responses.go | 621 ++++++++++++++++++ .../hostgroups/v1_hosts_get_parameters.go | 128 ++++ .../hostgroups/v1_hosts_get_responses.go | 471 +++++++++++++ .../v1_hosts_id_delete_parameters.go | 151 +++++ .../v1_hosts_id_delete_responses.go | 545 +++++++++++++++ .../hostgroups/v1_hosts_id_get_parameters.go | 151 +++++ .../hostgroups/v1_hosts_id_get_responses.go | 547 +++++++++++++++ .../hostgroups/v1_hosts_id_put_parameters.go | 175 +++++ .../hostgroups/v1_hosts_id_put_responses.go | 621 ++++++++++++++++++ .../hostgroups/v1_hosts_post_parameters.go | 153 +++++ .../hostgroups/v1_hosts_post_responses.go | 547 +++++++++++++++ power/client/power_iaas_api_client.go | 5 + power/models/add_host.go | 88 +++ power/models/available_host.go | 115 ++++ power/models/available_host_list.go | 67 ++ power/models/host.go | 167 +++++ power/models/host_available_capacity.go | 53 ++ power/models/host_capacity.go | 71 ++ power/models/host_create.go | 125 ++++ power/models/host_href.go | 27 + power/models/host_list.go | 78 +++ power/models/host_put.go | 71 ++ power/models/hostgroup.go | 143 ++++ power/models/hostgroup_create.go | 141 ++++ power/models/hostgroup_href.go | 27 + power/models/hostgroup_list.go | 78 +++ power/models/hostgroup_share_op.go | 124 ++++ power/models/hostgroup_with_sharing_info.go | 146 ++++ power/models/p_vm_instance_create.go | 3 + power/models/secondary.go | 74 +++ 40 files changed, 9007 insertions(+) create mode 100644 power/client/hostgroups/hostgroups_client.go create mode 100644 power/client/hostgroups/v1_available_hosts_parameters.go create mode 100644 power/client/hostgroups/v1_available_hosts_responses.go create mode 100644 power/client/hostgroups/v1_hostgroups_get_parameters.go create mode 100644 power/client/hostgroups/v1_hostgroups_get_responses.go create mode 100644 power/client/hostgroups/v1_hostgroups_id_get_parameters.go create mode 100644 power/client/hostgroups/v1_hostgroups_id_get_responses.go create mode 100644 power/client/hostgroups/v1_hostgroups_id_put_parameters.go create mode 100644 power/client/hostgroups/v1_hostgroups_id_put_responses.go create mode 100644 power/client/hostgroups/v1_hostgroups_post_parameters.go create mode 100644 power/client/hostgroups/v1_hostgroups_post_responses.go create mode 100644 power/client/hostgroups/v1_hosts_get_parameters.go create mode 100644 power/client/hostgroups/v1_hosts_get_responses.go create mode 100644 power/client/hostgroups/v1_hosts_id_delete_parameters.go create mode 100644 power/client/hostgroups/v1_hosts_id_delete_responses.go create mode 100644 power/client/hostgroups/v1_hosts_id_get_parameters.go create mode 100644 power/client/hostgroups/v1_hosts_id_get_responses.go create mode 100644 power/client/hostgroups/v1_hosts_id_put_parameters.go create mode 100644 power/client/hostgroups/v1_hosts_id_put_responses.go create mode 100644 power/client/hostgroups/v1_hosts_post_parameters.go create mode 100644 power/client/hostgroups/v1_hosts_post_responses.go create mode 100644 power/models/add_host.go create mode 100644 power/models/available_host.go create mode 100644 power/models/available_host_list.go create mode 100644 power/models/host.go create mode 100644 power/models/host_available_capacity.go create mode 100644 power/models/host_capacity.go create mode 100644 power/models/host_create.go create mode 100644 power/models/host_href.go create mode 100644 power/models/host_list.go create mode 100644 power/models/host_put.go create mode 100644 power/models/hostgroup.go create mode 100644 power/models/hostgroup_create.go create mode 100644 power/models/hostgroup_href.go create mode 100644 power/models/hostgroup_list.go create mode 100644 power/models/hostgroup_share_op.go create mode 100644 power/models/hostgroup_with_sharing_info.go create mode 100644 power/models/secondary.go diff --git a/power/client/hostgroups/hostgroups_client.go b/power/client/hostgroups/hostgroups_client.go new file mode 100644 index 00000000..19daf7c8 --- /dev/null +++ b/power/client/hostgroups/hostgroups_client.go @@ -0,0 +1,449 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hostgroups + +// 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 hostgroups API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for hostgroups 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 { + V1AvailableHosts(params *V1AvailableHostsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1AvailableHostsOK, error) + + V1HostgroupsGet(params *V1HostgroupsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1HostgroupsGetOK, error) + + V1HostgroupsIDGet(params *V1HostgroupsIDGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1HostgroupsIDGetOK, error) + + V1HostgroupsIDPut(params *V1HostgroupsIDPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1HostgroupsIDPutOK, error) + + V1HostgroupsPost(params *V1HostgroupsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1HostgroupsPostCreated, error) + + V1HostsGet(params *V1HostsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1HostsGetOK, error) + + V1HostsIDDelete(params *V1HostsIDDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1HostsIDDeleteAccepted, error) + + V1HostsIDGet(params *V1HostsIDGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1HostsIDGetOK, error) + + V1HostsIDPut(params *V1HostsIDPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1HostsIDPutOK, error) + + V1HostsPost(params *V1HostsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1HostsPostCreated, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +V1AvailableHosts lists all the hosts that can be reserved +*/ +func (a *Client) V1AvailableHosts(params *V1AvailableHostsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1AvailableHostsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1AvailableHostsParams() + } + op := &runtime.ClientOperation{ + ID: "v1.availableHosts", + Method: "GET", + PathPattern: "/v1/available-hosts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1AvailableHostsReader{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.(*V1AvailableHostsOK) + 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.availableHosts: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1HostgroupsGet gets the list of hostgroups for the workspace +*/ +func (a *Client) V1HostgroupsGet(params *V1HostgroupsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1HostgroupsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1HostgroupsGetParams() + } + op := &runtime.ClientOperation{ + ID: "v1.hostgroups.get", + Method: "GET", + PathPattern: "/v1/hostgroups", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1HostgroupsGetReader{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.(*V1HostgroupsGetOK) + 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.hostgroups.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1HostgroupsIDGet gets the details of a hostgroup +*/ +func (a *Client) V1HostgroupsIDGet(params *V1HostgroupsIDGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1HostgroupsIDGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1HostgroupsIDGetParams() + } + op := &runtime.ClientOperation{ + ID: "v1.hostgroups.id.get", + Method: "GET", + PathPattern: "/v1/hostgroups/{hostgroup_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1HostgroupsIDGetReader{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.(*V1HostgroupsIDGetOK) + 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.hostgroups.id.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1HostgroupsIDPut shares unshare a hostgroup with another workspace +*/ +func (a *Client) V1HostgroupsIDPut(params *V1HostgroupsIDPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1HostgroupsIDPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1HostgroupsIDPutParams() + } + op := &runtime.ClientOperation{ + ID: "v1.hostgroups.id.put", + Method: "PUT", + PathPattern: "/v1/hostgroups/{hostgroup_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1HostgroupsIDPutReader{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.(*V1HostgroupsIDPutOK) + 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.hostgroups.id.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1HostgroupsPost creates a hostgroup with one or more host +*/ +func (a *Client) V1HostgroupsPost(params *V1HostgroupsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1HostgroupsPostCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1HostgroupsPostParams() + } + op := &runtime.ClientOperation{ + ID: "v1.hostgroups.post", + Method: "POST", + PathPattern: "/v1/hostgroups", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1HostgroupsPostReader{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.(*V1HostgroupsPostCreated) + 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.hostgroups.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1HostsGet gets the list of all the hosts the workspace has access to +*/ +func (a *Client) V1HostsGet(params *V1HostsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1HostsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1HostsGetParams() + } + op := &runtime.ClientOperation{ + ID: "v1.hosts.get", + Method: "GET", + PathPattern: "/v1/hosts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1HostsGetReader{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.(*V1HostsGetOK) + 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.hosts.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1HostsIDDelete releases a host from its hostgroup +*/ +func (a *Client) V1HostsIDDelete(params *V1HostsIDDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1HostsIDDeleteAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1HostsIDDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "v1.hosts.id.delete", + Method: "DELETE", + PathPattern: "/v1/hosts/{host_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1HostsIDDeleteReader{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.(*V1HostsIDDeleteAccepted) + 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.hosts.id.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1HostsIDGet gets the details about a host +*/ +func (a *Client) V1HostsIDGet(params *V1HostsIDGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1HostsIDGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1HostsIDGetParams() + } + op := &runtime.ClientOperation{ + ID: "v1.hosts.id.get", + Method: "GET", + PathPattern: "/v1/hosts/{host_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1HostsIDGetReader{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.(*V1HostsIDGetOK) + 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.hosts.id.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1HostsIDPut modifies the display name of a host +*/ +func (a *Client) V1HostsIDPut(params *V1HostsIDPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1HostsIDPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1HostsIDPutParams() + } + op := &runtime.ClientOperation{ + ID: "v1.hosts.id.put", + Method: "PUT", + PathPattern: "/v1/hosts/{host_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1HostsIDPutReader{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.(*V1HostsIDPutOK) + 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.hosts.id.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1HostsPost adds new host s to an existing hostgroup +*/ +func (a *Client) V1HostsPost(params *V1HostsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1HostsPostCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1HostsPostParams() + } + op := &runtime.ClientOperation{ + ID: "v1.hosts.post", + Method: "POST", + PathPattern: "/v1/hosts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1HostsPostReader{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.(*V1HostsPostCreated) + 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.hosts.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/hostgroups/v1_available_hosts_parameters.go b/power/client/hostgroups/v1_available_hosts_parameters.go new file mode 100644 index 00000000..f2c3babf --- /dev/null +++ b/power/client/hostgroups/v1_available_hosts_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hostgroups + +// 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" +) + +// NewV1AvailableHostsParams creates a new V1AvailableHostsParams 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 NewV1AvailableHostsParams() *V1AvailableHostsParams { + return &V1AvailableHostsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1AvailableHostsParamsWithTimeout creates a new V1AvailableHostsParams object +// with the ability to set a timeout on a request. +func NewV1AvailableHostsParamsWithTimeout(timeout time.Duration) *V1AvailableHostsParams { + return &V1AvailableHostsParams{ + timeout: timeout, + } +} + +// NewV1AvailableHostsParamsWithContext creates a new V1AvailableHostsParams object +// with the ability to set a context for a request. +func NewV1AvailableHostsParamsWithContext(ctx context.Context) *V1AvailableHostsParams { + return &V1AvailableHostsParams{ + Context: ctx, + } +} + +// NewV1AvailableHostsParamsWithHTTPClient creates a new V1AvailableHostsParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1AvailableHostsParamsWithHTTPClient(client *http.Client) *V1AvailableHostsParams { + return &V1AvailableHostsParams{ + HTTPClient: client, + } +} + +/* +V1AvailableHostsParams contains all the parameters to send to the API endpoint + + for the v1 available hosts operation. + + Typically these are written to a http.Request. +*/ +type V1AvailableHostsParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 available hosts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1AvailableHostsParams) WithDefaults() *V1AvailableHostsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 available hosts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1AvailableHostsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 available hosts params +func (o *V1AvailableHostsParams) WithTimeout(timeout time.Duration) *V1AvailableHostsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 available hosts params +func (o *V1AvailableHostsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 available hosts params +func (o *V1AvailableHostsParams) WithContext(ctx context.Context) *V1AvailableHostsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 available hosts params +func (o *V1AvailableHostsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 available hosts params +func (o *V1AvailableHostsParams) WithHTTPClient(client *http.Client) *V1AvailableHostsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 available hosts params +func (o *V1AvailableHostsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *V1AvailableHostsParams) 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/hostgroups/v1_available_hosts_responses.go b/power/client/hostgroups/v1_available_hosts_responses.go new file mode 100644 index 00000000..a591b6e1 --- /dev/null +++ b/power/client/hostgroups/v1_available_hosts_responses.go @@ -0,0 +1,471 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hostgroups + +// 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" +) + +// V1AvailableHostsReader is a Reader for the V1AvailableHosts structure. +type V1AvailableHostsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1AvailableHostsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1AvailableHostsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1AvailableHostsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1AvailableHostsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1AvailableHostsForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1AvailableHostsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 504: + result := NewV1AvailableHostsGatewayTimeout() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/available-hosts] v1.availableHosts", response, response.Code()) + } +} + +// NewV1AvailableHostsOK creates a V1AvailableHostsOK with default headers values +func NewV1AvailableHostsOK() *V1AvailableHostsOK { + return &V1AvailableHostsOK{} +} + +/* +V1AvailableHostsOK describes a response with status code 200, with default header values. + +OK +*/ +type V1AvailableHostsOK struct { + Payload models.AvailableHostList +} + +// IsSuccess returns true when this v1 available hosts o k response has a 2xx status code +func (o *V1AvailableHostsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 available hosts o k response has a 3xx status code +func (o *V1AvailableHostsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 available hosts o k response has a 4xx status code +func (o *V1AvailableHostsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 available hosts o k response has a 5xx status code +func (o *V1AvailableHostsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 available hosts o k response a status code equal to that given +func (o *V1AvailableHostsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 available hosts o k response +func (o *V1AvailableHostsOK) Code() int { + return 200 +} + +func (o *V1AvailableHostsOK) Error() string { + return fmt.Sprintf("[GET /v1/available-hosts][%d] v1AvailableHostsOK %+v", 200, o.Payload) +} + +func (o *V1AvailableHostsOK) String() string { + return fmt.Sprintf("[GET /v1/available-hosts][%d] v1AvailableHostsOK %+v", 200, o.Payload) +} + +func (o *V1AvailableHostsOK) GetPayload() models.AvailableHostList { + return o.Payload +} + +func (o *V1AvailableHostsOK) 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 +} + +// NewV1AvailableHostsBadRequest creates a V1AvailableHostsBadRequest with default headers values +func NewV1AvailableHostsBadRequest() *V1AvailableHostsBadRequest { + return &V1AvailableHostsBadRequest{} +} + +/* +V1AvailableHostsBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1AvailableHostsBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 available hosts bad request response has a 2xx status code +func (o *V1AvailableHostsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 available hosts bad request response has a 3xx status code +func (o *V1AvailableHostsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 available hosts bad request response has a 4xx status code +func (o *V1AvailableHostsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 available hosts bad request response has a 5xx status code +func (o *V1AvailableHostsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 available hosts bad request response a status code equal to that given +func (o *V1AvailableHostsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 available hosts bad request response +func (o *V1AvailableHostsBadRequest) Code() int { + return 400 +} + +func (o *V1AvailableHostsBadRequest) Error() string { + return fmt.Sprintf("[GET /v1/available-hosts][%d] v1AvailableHostsBadRequest %+v", 400, o.Payload) +} + +func (o *V1AvailableHostsBadRequest) String() string { + return fmt.Sprintf("[GET /v1/available-hosts][%d] v1AvailableHostsBadRequest %+v", 400, o.Payload) +} + +func (o *V1AvailableHostsBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1AvailableHostsBadRequest) 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 +} + +// NewV1AvailableHostsUnauthorized creates a V1AvailableHostsUnauthorized with default headers values +func NewV1AvailableHostsUnauthorized() *V1AvailableHostsUnauthorized { + return &V1AvailableHostsUnauthorized{} +} + +/* +V1AvailableHostsUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1AvailableHostsUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 available hosts unauthorized response has a 2xx status code +func (o *V1AvailableHostsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 available hosts unauthorized response has a 3xx status code +func (o *V1AvailableHostsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 available hosts unauthorized response has a 4xx status code +func (o *V1AvailableHostsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 available hosts unauthorized response has a 5xx status code +func (o *V1AvailableHostsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 available hosts unauthorized response a status code equal to that given +func (o *V1AvailableHostsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 available hosts unauthorized response +func (o *V1AvailableHostsUnauthorized) Code() int { + return 401 +} + +func (o *V1AvailableHostsUnauthorized) Error() string { + return fmt.Sprintf("[GET /v1/available-hosts][%d] v1AvailableHostsUnauthorized %+v", 401, o.Payload) +} + +func (o *V1AvailableHostsUnauthorized) String() string { + return fmt.Sprintf("[GET /v1/available-hosts][%d] v1AvailableHostsUnauthorized %+v", 401, o.Payload) +} + +func (o *V1AvailableHostsUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1AvailableHostsUnauthorized) 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 +} + +// NewV1AvailableHostsForbidden creates a V1AvailableHostsForbidden with default headers values +func NewV1AvailableHostsForbidden() *V1AvailableHostsForbidden { + return &V1AvailableHostsForbidden{} +} + +/* +V1AvailableHostsForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1AvailableHostsForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 available hosts forbidden response has a 2xx status code +func (o *V1AvailableHostsForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 available hosts forbidden response has a 3xx status code +func (o *V1AvailableHostsForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 available hosts forbidden response has a 4xx status code +func (o *V1AvailableHostsForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 available hosts forbidden response has a 5xx status code +func (o *V1AvailableHostsForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 available hosts forbidden response a status code equal to that given +func (o *V1AvailableHostsForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 available hosts forbidden response +func (o *V1AvailableHostsForbidden) Code() int { + return 403 +} + +func (o *V1AvailableHostsForbidden) Error() string { + return fmt.Sprintf("[GET /v1/available-hosts][%d] v1AvailableHostsForbidden %+v", 403, o.Payload) +} + +func (o *V1AvailableHostsForbidden) String() string { + return fmt.Sprintf("[GET /v1/available-hosts][%d] v1AvailableHostsForbidden %+v", 403, o.Payload) +} + +func (o *V1AvailableHostsForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1AvailableHostsForbidden) 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 +} + +// NewV1AvailableHostsInternalServerError creates a V1AvailableHostsInternalServerError with default headers values +func NewV1AvailableHostsInternalServerError() *V1AvailableHostsInternalServerError { + return &V1AvailableHostsInternalServerError{} +} + +/* +V1AvailableHostsInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1AvailableHostsInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 available hosts internal server error response has a 2xx status code +func (o *V1AvailableHostsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 available hosts internal server error response has a 3xx status code +func (o *V1AvailableHostsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 available hosts internal server error response has a 4xx status code +func (o *V1AvailableHostsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 available hosts internal server error response has a 5xx status code +func (o *V1AvailableHostsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 available hosts internal server error response a status code equal to that given +func (o *V1AvailableHostsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 available hosts internal server error response +func (o *V1AvailableHostsInternalServerError) Code() int { + return 500 +} + +func (o *V1AvailableHostsInternalServerError) Error() string { + return fmt.Sprintf("[GET /v1/available-hosts][%d] v1AvailableHostsInternalServerError %+v", 500, o.Payload) +} + +func (o *V1AvailableHostsInternalServerError) String() string { + return fmt.Sprintf("[GET /v1/available-hosts][%d] v1AvailableHostsInternalServerError %+v", 500, o.Payload) +} + +func (o *V1AvailableHostsInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1AvailableHostsInternalServerError) 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 +} + +// NewV1AvailableHostsGatewayTimeout creates a V1AvailableHostsGatewayTimeout with default headers values +func NewV1AvailableHostsGatewayTimeout() *V1AvailableHostsGatewayTimeout { + return &V1AvailableHostsGatewayTimeout{} +} + +/* +V1AvailableHostsGatewayTimeout describes a response with status code 504, with default header values. + +Gateway Timeout. Request is still processing and taking longer than expected. +*/ +type V1AvailableHostsGatewayTimeout struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 available hosts gateway timeout response has a 2xx status code +func (o *V1AvailableHostsGatewayTimeout) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 available hosts gateway timeout response has a 3xx status code +func (o *V1AvailableHostsGatewayTimeout) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 available hosts gateway timeout response has a 4xx status code +func (o *V1AvailableHostsGatewayTimeout) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 available hosts gateway timeout response has a 5xx status code +func (o *V1AvailableHostsGatewayTimeout) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 available hosts gateway timeout response a status code equal to that given +func (o *V1AvailableHostsGatewayTimeout) IsCode(code int) bool { + return code == 504 +} + +// Code gets the status code for the v1 available hosts gateway timeout response +func (o *V1AvailableHostsGatewayTimeout) Code() int { + return 504 +} + +func (o *V1AvailableHostsGatewayTimeout) Error() string { + return fmt.Sprintf("[GET /v1/available-hosts][%d] v1AvailableHostsGatewayTimeout %+v", 504, o.Payload) +} + +func (o *V1AvailableHostsGatewayTimeout) String() string { + return fmt.Sprintf("[GET /v1/available-hosts][%d] v1AvailableHostsGatewayTimeout %+v", 504, o.Payload) +} + +func (o *V1AvailableHostsGatewayTimeout) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1AvailableHostsGatewayTimeout) 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/hostgroups/v1_hostgroups_get_parameters.go b/power/client/hostgroups/v1_hostgroups_get_parameters.go new file mode 100644 index 00000000..e4c9dcc2 --- /dev/null +++ b/power/client/hostgroups/v1_hostgroups_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hostgroups + +// 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" +) + +// NewV1HostgroupsGetParams creates a new V1HostgroupsGetParams 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 NewV1HostgroupsGetParams() *V1HostgroupsGetParams { + return &V1HostgroupsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1HostgroupsGetParamsWithTimeout creates a new V1HostgroupsGetParams object +// with the ability to set a timeout on a request. +func NewV1HostgroupsGetParamsWithTimeout(timeout time.Duration) *V1HostgroupsGetParams { + return &V1HostgroupsGetParams{ + timeout: timeout, + } +} + +// NewV1HostgroupsGetParamsWithContext creates a new V1HostgroupsGetParams object +// with the ability to set a context for a request. +func NewV1HostgroupsGetParamsWithContext(ctx context.Context) *V1HostgroupsGetParams { + return &V1HostgroupsGetParams{ + Context: ctx, + } +} + +// NewV1HostgroupsGetParamsWithHTTPClient creates a new V1HostgroupsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1HostgroupsGetParamsWithHTTPClient(client *http.Client) *V1HostgroupsGetParams { + return &V1HostgroupsGetParams{ + HTTPClient: client, + } +} + +/* +V1HostgroupsGetParams contains all the parameters to send to the API endpoint + + for the v1 hostgroups get operation. + + Typically these are written to a http.Request. +*/ +type V1HostgroupsGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 hostgroups get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1HostgroupsGetParams) WithDefaults() *V1HostgroupsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 hostgroups get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1HostgroupsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 hostgroups get params +func (o *V1HostgroupsGetParams) WithTimeout(timeout time.Duration) *V1HostgroupsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 hostgroups get params +func (o *V1HostgroupsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 hostgroups get params +func (o *V1HostgroupsGetParams) WithContext(ctx context.Context) *V1HostgroupsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 hostgroups get params +func (o *V1HostgroupsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 hostgroups get params +func (o *V1HostgroupsGetParams) WithHTTPClient(client *http.Client) *V1HostgroupsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 hostgroups get params +func (o *V1HostgroupsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *V1HostgroupsGetParams) 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/hostgroups/v1_hostgroups_get_responses.go b/power/client/hostgroups/v1_hostgroups_get_responses.go new file mode 100644 index 00000000..6ee0eeca --- /dev/null +++ b/power/client/hostgroups/v1_hostgroups_get_responses.go @@ -0,0 +1,471 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hostgroups + +// 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" +) + +// V1HostgroupsGetReader is a Reader for the V1HostgroupsGet structure. +type V1HostgroupsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1HostgroupsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1HostgroupsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1HostgroupsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1HostgroupsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1HostgroupsGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1HostgroupsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 504: + result := NewV1HostgroupsGetGatewayTimeout() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/hostgroups] v1.hostgroups.get", response, response.Code()) + } +} + +// NewV1HostgroupsGetOK creates a V1HostgroupsGetOK with default headers values +func NewV1HostgroupsGetOK() *V1HostgroupsGetOK { + return &V1HostgroupsGetOK{} +} + +/* +V1HostgroupsGetOK describes a response with status code 200, with default header values. + +OK +*/ +type V1HostgroupsGetOK struct { + Payload models.HostgroupList +} + +// IsSuccess returns true when this v1 hostgroups get o k response has a 2xx status code +func (o *V1HostgroupsGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 hostgroups get o k response has a 3xx status code +func (o *V1HostgroupsGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups get o k response has a 4xx status code +func (o *V1HostgroupsGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hostgroups get o k response has a 5xx status code +func (o *V1HostgroupsGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hostgroups get o k response a status code equal to that given +func (o *V1HostgroupsGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 hostgroups get o k response +func (o *V1HostgroupsGetOK) Code() int { + return 200 +} + +func (o *V1HostgroupsGetOK) Error() string { + return fmt.Sprintf("[GET /v1/hostgroups][%d] v1HostgroupsGetOK %+v", 200, o.Payload) +} + +func (o *V1HostgroupsGetOK) String() string { + return fmt.Sprintf("[GET /v1/hostgroups][%d] v1HostgroupsGetOK %+v", 200, o.Payload) +} + +func (o *V1HostgroupsGetOK) GetPayload() models.HostgroupList { + return o.Payload +} + +func (o *V1HostgroupsGetOK) 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 +} + +// NewV1HostgroupsGetBadRequest creates a V1HostgroupsGetBadRequest with default headers values +func NewV1HostgroupsGetBadRequest() *V1HostgroupsGetBadRequest { + return &V1HostgroupsGetBadRequest{} +} + +/* +V1HostgroupsGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1HostgroupsGetBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups get bad request response has a 2xx status code +func (o *V1HostgroupsGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups get bad request response has a 3xx status code +func (o *V1HostgroupsGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups get bad request response has a 4xx status code +func (o *V1HostgroupsGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hostgroups get bad request response has a 5xx status code +func (o *V1HostgroupsGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hostgroups get bad request response a status code equal to that given +func (o *V1HostgroupsGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 hostgroups get bad request response +func (o *V1HostgroupsGetBadRequest) Code() int { + return 400 +} + +func (o *V1HostgroupsGetBadRequest) Error() string { + return fmt.Sprintf("[GET /v1/hostgroups][%d] v1HostgroupsGetBadRequest %+v", 400, o.Payload) +} + +func (o *V1HostgroupsGetBadRequest) String() string { + return fmt.Sprintf("[GET /v1/hostgroups][%d] v1HostgroupsGetBadRequest %+v", 400, o.Payload) +} + +func (o *V1HostgroupsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsGetBadRequest) 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 +} + +// NewV1HostgroupsGetUnauthorized creates a V1HostgroupsGetUnauthorized with default headers values +func NewV1HostgroupsGetUnauthorized() *V1HostgroupsGetUnauthorized { + return &V1HostgroupsGetUnauthorized{} +} + +/* +V1HostgroupsGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1HostgroupsGetUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups get unauthorized response has a 2xx status code +func (o *V1HostgroupsGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups get unauthorized response has a 3xx status code +func (o *V1HostgroupsGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups get unauthorized response has a 4xx status code +func (o *V1HostgroupsGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hostgroups get unauthorized response has a 5xx status code +func (o *V1HostgroupsGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hostgroups get unauthorized response a status code equal to that given +func (o *V1HostgroupsGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 hostgroups get unauthorized response +func (o *V1HostgroupsGetUnauthorized) Code() int { + return 401 +} + +func (o *V1HostgroupsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /v1/hostgroups][%d] v1HostgroupsGetUnauthorized %+v", 401, o.Payload) +} + +func (o *V1HostgroupsGetUnauthorized) String() string { + return fmt.Sprintf("[GET /v1/hostgroups][%d] v1HostgroupsGetUnauthorized %+v", 401, o.Payload) +} + +func (o *V1HostgroupsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsGetUnauthorized) 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 +} + +// NewV1HostgroupsGetForbidden creates a V1HostgroupsGetForbidden with default headers values +func NewV1HostgroupsGetForbidden() *V1HostgroupsGetForbidden { + return &V1HostgroupsGetForbidden{} +} + +/* +V1HostgroupsGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1HostgroupsGetForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups get forbidden response has a 2xx status code +func (o *V1HostgroupsGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups get forbidden response has a 3xx status code +func (o *V1HostgroupsGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups get forbidden response has a 4xx status code +func (o *V1HostgroupsGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hostgroups get forbidden response has a 5xx status code +func (o *V1HostgroupsGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hostgroups get forbidden response a status code equal to that given +func (o *V1HostgroupsGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 hostgroups get forbidden response +func (o *V1HostgroupsGetForbidden) Code() int { + return 403 +} + +func (o *V1HostgroupsGetForbidden) Error() string { + return fmt.Sprintf("[GET /v1/hostgroups][%d] v1HostgroupsGetForbidden %+v", 403, o.Payload) +} + +func (o *V1HostgroupsGetForbidden) String() string { + return fmt.Sprintf("[GET /v1/hostgroups][%d] v1HostgroupsGetForbidden %+v", 403, o.Payload) +} + +func (o *V1HostgroupsGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsGetForbidden) 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 +} + +// NewV1HostgroupsGetInternalServerError creates a V1HostgroupsGetInternalServerError with default headers values +func NewV1HostgroupsGetInternalServerError() *V1HostgroupsGetInternalServerError { + return &V1HostgroupsGetInternalServerError{} +} + +/* +V1HostgroupsGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1HostgroupsGetInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups get internal server error response has a 2xx status code +func (o *V1HostgroupsGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups get internal server error response has a 3xx status code +func (o *V1HostgroupsGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups get internal server error response has a 4xx status code +func (o *V1HostgroupsGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hostgroups get internal server error response has a 5xx status code +func (o *V1HostgroupsGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 hostgroups get internal server error response a status code equal to that given +func (o *V1HostgroupsGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 hostgroups get internal server error response +func (o *V1HostgroupsGetInternalServerError) Code() int { + return 500 +} + +func (o *V1HostgroupsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /v1/hostgroups][%d] v1HostgroupsGetInternalServerError %+v", 500, o.Payload) +} + +func (o *V1HostgroupsGetInternalServerError) String() string { + return fmt.Sprintf("[GET /v1/hostgroups][%d] v1HostgroupsGetInternalServerError %+v", 500, o.Payload) +} + +func (o *V1HostgroupsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsGetInternalServerError) 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 +} + +// NewV1HostgroupsGetGatewayTimeout creates a V1HostgroupsGetGatewayTimeout with default headers values +func NewV1HostgroupsGetGatewayTimeout() *V1HostgroupsGetGatewayTimeout { + return &V1HostgroupsGetGatewayTimeout{} +} + +/* +V1HostgroupsGetGatewayTimeout describes a response with status code 504, with default header values. + +Gateway Timeout. Request is still processing and taking longer than expected. +*/ +type V1HostgroupsGetGatewayTimeout struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups get gateway timeout response has a 2xx status code +func (o *V1HostgroupsGetGatewayTimeout) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups get gateway timeout response has a 3xx status code +func (o *V1HostgroupsGetGatewayTimeout) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups get gateway timeout response has a 4xx status code +func (o *V1HostgroupsGetGatewayTimeout) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hostgroups get gateway timeout response has a 5xx status code +func (o *V1HostgroupsGetGatewayTimeout) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 hostgroups get gateway timeout response a status code equal to that given +func (o *V1HostgroupsGetGatewayTimeout) IsCode(code int) bool { + return code == 504 +} + +// Code gets the status code for the v1 hostgroups get gateway timeout response +func (o *V1HostgroupsGetGatewayTimeout) Code() int { + return 504 +} + +func (o *V1HostgroupsGetGatewayTimeout) Error() string { + return fmt.Sprintf("[GET /v1/hostgroups][%d] v1HostgroupsGetGatewayTimeout %+v", 504, o.Payload) +} + +func (o *V1HostgroupsGetGatewayTimeout) String() string { + return fmt.Sprintf("[GET /v1/hostgroups][%d] v1HostgroupsGetGatewayTimeout %+v", 504, o.Payload) +} + +func (o *V1HostgroupsGetGatewayTimeout) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsGetGatewayTimeout) 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/hostgroups/v1_hostgroups_id_get_parameters.go b/power/client/hostgroups/v1_hostgroups_id_get_parameters.go new file mode 100644 index 00000000..f266f7eb --- /dev/null +++ b/power/client/hostgroups/v1_hostgroups_id_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hostgroups + +// 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" +) + +// NewV1HostgroupsIDGetParams creates a new V1HostgroupsIDGetParams 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 NewV1HostgroupsIDGetParams() *V1HostgroupsIDGetParams { + return &V1HostgroupsIDGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1HostgroupsIDGetParamsWithTimeout creates a new V1HostgroupsIDGetParams object +// with the ability to set a timeout on a request. +func NewV1HostgroupsIDGetParamsWithTimeout(timeout time.Duration) *V1HostgroupsIDGetParams { + return &V1HostgroupsIDGetParams{ + timeout: timeout, + } +} + +// NewV1HostgroupsIDGetParamsWithContext creates a new V1HostgroupsIDGetParams object +// with the ability to set a context for a request. +func NewV1HostgroupsIDGetParamsWithContext(ctx context.Context) *V1HostgroupsIDGetParams { + return &V1HostgroupsIDGetParams{ + Context: ctx, + } +} + +// NewV1HostgroupsIDGetParamsWithHTTPClient creates a new V1HostgroupsIDGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1HostgroupsIDGetParamsWithHTTPClient(client *http.Client) *V1HostgroupsIDGetParams { + return &V1HostgroupsIDGetParams{ + HTTPClient: client, + } +} + +/* +V1HostgroupsIDGetParams contains all the parameters to send to the API endpoint + + for the v1 hostgroups id get operation. + + Typically these are written to a http.Request. +*/ +type V1HostgroupsIDGetParams struct { + + /* HostgroupID. + + Hostgroup ID + */ + HostgroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 hostgroups id get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1HostgroupsIDGetParams) WithDefaults() *V1HostgroupsIDGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 hostgroups id get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1HostgroupsIDGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 hostgroups id get params +func (o *V1HostgroupsIDGetParams) WithTimeout(timeout time.Duration) *V1HostgroupsIDGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 hostgroups id get params +func (o *V1HostgroupsIDGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 hostgroups id get params +func (o *V1HostgroupsIDGetParams) WithContext(ctx context.Context) *V1HostgroupsIDGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 hostgroups id get params +func (o *V1HostgroupsIDGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 hostgroups id get params +func (o *V1HostgroupsIDGetParams) WithHTTPClient(client *http.Client) *V1HostgroupsIDGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 hostgroups id get params +func (o *V1HostgroupsIDGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithHostgroupID adds the hostgroupID to the v1 hostgroups id get params +func (o *V1HostgroupsIDGetParams) WithHostgroupID(hostgroupID string) *V1HostgroupsIDGetParams { + o.SetHostgroupID(hostgroupID) + return o +} + +// SetHostgroupID adds the hostgroupId to the v1 hostgroups id get params +func (o *V1HostgroupsIDGetParams) SetHostgroupID(hostgroupID string) { + o.HostgroupID = hostgroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1HostgroupsIDGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param hostgroup_id + if err := r.SetPathParam("hostgroup_id", o.HostgroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/hostgroups/v1_hostgroups_id_get_responses.go b/power/client/hostgroups/v1_hostgroups_id_get_responses.go new file mode 100644 index 00000000..b028ca1a --- /dev/null +++ b/power/client/hostgroups/v1_hostgroups_id_get_responses.go @@ -0,0 +1,547 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hostgroups + +// 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" +) + +// V1HostgroupsIDGetReader is a Reader for the V1HostgroupsIDGet structure. +type V1HostgroupsIDGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1HostgroupsIDGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1HostgroupsIDGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1HostgroupsIDGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1HostgroupsIDGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1HostgroupsIDGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1HostgroupsIDGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1HostgroupsIDGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 504: + result := NewV1HostgroupsIDGetGatewayTimeout() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/hostgroups/{hostgroup_id}] v1.hostgroups.id.get", response, response.Code()) + } +} + +// NewV1HostgroupsIDGetOK creates a V1HostgroupsIDGetOK with default headers values +func NewV1HostgroupsIDGetOK() *V1HostgroupsIDGetOK { + return &V1HostgroupsIDGetOK{} +} + +/* +V1HostgroupsIDGetOK describes a response with status code 200, with default header values. + +OK +*/ +type V1HostgroupsIDGetOK struct { + Payload *models.HostgroupWithSharingInfo +} + +// IsSuccess returns true when this v1 hostgroups Id get o k response has a 2xx status code +func (o *V1HostgroupsIDGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 hostgroups Id get o k response has a 3xx status code +func (o *V1HostgroupsIDGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups Id get o k response has a 4xx status code +func (o *V1HostgroupsIDGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hostgroups Id get o k response has a 5xx status code +func (o *V1HostgroupsIDGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hostgroups Id get o k response a status code equal to that given +func (o *V1HostgroupsIDGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 hostgroups Id get o k response +func (o *V1HostgroupsIDGetOK) Code() int { + return 200 +} + +func (o *V1HostgroupsIDGetOK) Error() string { + return fmt.Sprintf("[GET /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdGetOK %+v", 200, o.Payload) +} + +func (o *V1HostgroupsIDGetOK) String() string { + return fmt.Sprintf("[GET /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdGetOK %+v", 200, o.Payload) +} + +func (o *V1HostgroupsIDGetOK) GetPayload() *models.HostgroupWithSharingInfo { + return o.Payload +} + +func (o *V1HostgroupsIDGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HostgroupWithSharingInfo) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1HostgroupsIDGetBadRequest creates a V1HostgroupsIDGetBadRequest with default headers values +func NewV1HostgroupsIDGetBadRequest() *V1HostgroupsIDGetBadRequest { + return &V1HostgroupsIDGetBadRequest{} +} + +/* +V1HostgroupsIDGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1HostgroupsIDGetBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups Id get bad request response has a 2xx status code +func (o *V1HostgroupsIDGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups Id get bad request response has a 3xx status code +func (o *V1HostgroupsIDGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups Id get bad request response has a 4xx status code +func (o *V1HostgroupsIDGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hostgroups Id get bad request response has a 5xx status code +func (o *V1HostgroupsIDGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hostgroups Id get bad request response a status code equal to that given +func (o *V1HostgroupsIDGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 hostgroups Id get bad request response +func (o *V1HostgroupsIDGetBadRequest) Code() int { + return 400 +} + +func (o *V1HostgroupsIDGetBadRequest) Error() string { + return fmt.Sprintf("[GET /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdGetBadRequest %+v", 400, o.Payload) +} + +func (o *V1HostgroupsIDGetBadRequest) String() string { + return fmt.Sprintf("[GET /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdGetBadRequest %+v", 400, o.Payload) +} + +func (o *V1HostgroupsIDGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsIDGetBadRequest) 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 +} + +// NewV1HostgroupsIDGetUnauthorized creates a V1HostgroupsIDGetUnauthorized with default headers values +func NewV1HostgroupsIDGetUnauthorized() *V1HostgroupsIDGetUnauthorized { + return &V1HostgroupsIDGetUnauthorized{} +} + +/* +V1HostgroupsIDGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1HostgroupsIDGetUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups Id get unauthorized response has a 2xx status code +func (o *V1HostgroupsIDGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups Id get unauthorized response has a 3xx status code +func (o *V1HostgroupsIDGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups Id get unauthorized response has a 4xx status code +func (o *V1HostgroupsIDGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hostgroups Id get unauthorized response has a 5xx status code +func (o *V1HostgroupsIDGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hostgroups Id get unauthorized response a status code equal to that given +func (o *V1HostgroupsIDGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 hostgroups Id get unauthorized response +func (o *V1HostgroupsIDGetUnauthorized) Code() int { + return 401 +} + +func (o *V1HostgroupsIDGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdGetUnauthorized %+v", 401, o.Payload) +} + +func (o *V1HostgroupsIDGetUnauthorized) String() string { + return fmt.Sprintf("[GET /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdGetUnauthorized %+v", 401, o.Payload) +} + +func (o *V1HostgroupsIDGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsIDGetUnauthorized) 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 +} + +// NewV1HostgroupsIDGetForbidden creates a V1HostgroupsIDGetForbidden with default headers values +func NewV1HostgroupsIDGetForbidden() *V1HostgroupsIDGetForbidden { + return &V1HostgroupsIDGetForbidden{} +} + +/* +V1HostgroupsIDGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1HostgroupsIDGetForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups Id get forbidden response has a 2xx status code +func (o *V1HostgroupsIDGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups Id get forbidden response has a 3xx status code +func (o *V1HostgroupsIDGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups Id get forbidden response has a 4xx status code +func (o *V1HostgroupsIDGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hostgroups Id get forbidden response has a 5xx status code +func (o *V1HostgroupsIDGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hostgroups Id get forbidden response a status code equal to that given +func (o *V1HostgroupsIDGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 hostgroups Id get forbidden response +func (o *V1HostgroupsIDGetForbidden) Code() int { + return 403 +} + +func (o *V1HostgroupsIDGetForbidden) Error() string { + return fmt.Sprintf("[GET /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdGetForbidden %+v", 403, o.Payload) +} + +func (o *V1HostgroupsIDGetForbidden) String() string { + return fmt.Sprintf("[GET /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdGetForbidden %+v", 403, o.Payload) +} + +func (o *V1HostgroupsIDGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsIDGetForbidden) 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 +} + +// NewV1HostgroupsIDGetNotFound creates a V1HostgroupsIDGetNotFound with default headers values +func NewV1HostgroupsIDGetNotFound() *V1HostgroupsIDGetNotFound { + return &V1HostgroupsIDGetNotFound{} +} + +/* +V1HostgroupsIDGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1HostgroupsIDGetNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups Id get not found response has a 2xx status code +func (o *V1HostgroupsIDGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups Id get not found response has a 3xx status code +func (o *V1HostgroupsIDGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups Id get not found response has a 4xx status code +func (o *V1HostgroupsIDGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hostgroups Id get not found response has a 5xx status code +func (o *V1HostgroupsIDGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hostgroups Id get not found response a status code equal to that given +func (o *V1HostgroupsIDGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 hostgroups Id get not found response +func (o *V1HostgroupsIDGetNotFound) Code() int { + return 404 +} + +func (o *V1HostgroupsIDGetNotFound) Error() string { + return fmt.Sprintf("[GET /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdGetNotFound %+v", 404, o.Payload) +} + +func (o *V1HostgroupsIDGetNotFound) String() string { + return fmt.Sprintf("[GET /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdGetNotFound %+v", 404, o.Payload) +} + +func (o *V1HostgroupsIDGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsIDGetNotFound) 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 +} + +// NewV1HostgroupsIDGetInternalServerError creates a V1HostgroupsIDGetInternalServerError with default headers values +func NewV1HostgroupsIDGetInternalServerError() *V1HostgroupsIDGetInternalServerError { + return &V1HostgroupsIDGetInternalServerError{} +} + +/* +V1HostgroupsIDGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1HostgroupsIDGetInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups Id get internal server error response has a 2xx status code +func (o *V1HostgroupsIDGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups Id get internal server error response has a 3xx status code +func (o *V1HostgroupsIDGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups Id get internal server error response has a 4xx status code +func (o *V1HostgroupsIDGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hostgroups Id get internal server error response has a 5xx status code +func (o *V1HostgroupsIDGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 hostgroups Id get internal server error response a status code equal to that given +func (o *V1HostgroupsIDGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 hostgroups Id get internal server error response +func (o *V1HostgroupsIDGetInternalServerError) Code() int { + return 500 +} + +func (o *V1HostgroupsIDGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdGetInternalServerError %+v", 500, o.Payload) +} + +func (o *V1HostgroupsIDGetInternalServerError) String() string { + return fmt.Sprintf("[GET /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdGetInternalServerError %+v", 500, o.Payload) +} + +func (o *V1HostgroupsIDGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsIDGetInternalServerError) 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 +} + +// NewV1HostgroupsIDGetGatewayTimeout creates a V1HostgroupsIDGetGatewayTimeout with default headers values +func NewV1HostgroupsIDGetGatewayTimeout() *V1HostgroupsIDGetGatewayTimeout { + return &V1HostgroupsIDGetGatewayTimeout{} +} + +/* +V1HostgroupsIDGetGatewayTimeout describes a response with status code 504, with default header values. + +Gateway Timeout. Request is still processing and taking longer than expected. +*/ +type V1HostgroupsIDGetGatewayTimeout struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups Id get gateway timeout response has a 2xx status code +func (o *V1HostgroupsIDGetGatewayTimeout) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups Id get gateway timeout response has a 3xx status code +func (o *V1HostgroupsIDGetGatewayTimeout) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups Id get gateway timeout response has a 4xx status code +func (o *V1HostgroupsIDGetGatewayTimeout) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hostgroups Id get gateway timeout response has a 5xx status code +func (o *V1HostgroupsIDGetGatewayTimeout) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 hostgroups Id get gateway timeout response a status code equal to that given +func (o *V1HostgroupsIDGetGatewayTimeout) IsCode(code int) bool { + return code == 504 +} + +// Code gets the status code for the v1 hostgroups Id get gateway timeout response +func (o *V1HostgroupsIDGetGatewayTimeout) Code() int { + return 504 +} + +func (o *V1HostgroupsIDGetGatewayTimeout) Error() string { + return fmt.Sprintf("[GET /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdGetGatewayTimeout %+v", 504, o.Payload) +} + +func (o *V1HostgroupsIDGetGatewayTimeout) String() string { + return fmt.Sprintf("[GET /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdGetGatewayTimeout %+v", 504, o.Payload) +} + +func (o *V1HostgroupsIDGetGatewayTimeout) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsIDGetGatewayTimeout) 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/hostgroups/v1_hostgroups_id_put_parameters.go b/power/client/hostgroups/v1_hostgroups_id_put_parameters.go new file mode 100644 index 00000000..61e2d566 --- /dev/null +++ b/power/client/hostgroups/v1_hostgroups_id_put_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hostgroups + +// 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" +) + +// NewV1HostgroupsIDPutParams creates a new V1HostgroupsIDPutParams 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 NewV1HostgroupsIDPutParams() *V1HostgroupsIDPutParams { + return &V1HostgroupsIDPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1HostgroupsIDPutParamsWithTimeout creates a new V1HostgroupsIDPutParams object +// with the ability to set a timeout on a request. +func NewV1HostgroupsIDPutParamsWithTimeout(timeout time.Duration) *V1HostgroupsIDPutParams { + return &V1HostgroupsIDPutParams{ + timeout: timeout, + } +} + +// NewV1HostgroupsIDPutParamsWithContext creates a new V1HostgroupsIDPutParams object +// with the ability to set a context for a request. +func NewV1HostgroupsIDPutParamsWithContext(ctx context.Context) *V1HostgroupsIDPutParams { + return &V1HostgroupsIDPutParams{ + Context: ctx, + } +} + +// NewV1HostgroupsIDPutParamsWithHTTPClient creates a new V1HostgroupsIDPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1HostgroupsIDPutParamsWithHTTPClient(client *http.Client) *V1HostgroupsIDPutParams { + return &V1HostgroupsIDPutParams{ + HTTPClient: client, + } +} + +/* +V1HostgroupsIDPutParams contains all the parameters to send to the API endpoint + + for the v1 hostgroups id put operation. + + Typically these are written to a http.Request. +*/ +type V1HostgroupsIDPutParams struct { + + /* Body. + + Parameters to set the sharing status of the hostgroup + */ + Body *models.HostgroupShareOp + + /* HostgroupID. + + Hostgroup ID + */ + HostgroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 hostgroups id put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1HostgroupsIDPutParams) WithDefaults() *V1HostgroupsIDPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 hostgroups id put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1HostgroupsIDPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 hostgroups id put params +func (o *V1HostgroupsIDPutParams) WithTimeout(timeout time.Duration) *V1HostgroupsIDPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 hostgroups id put params +func (o *V1HostgroupsIDPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 hostgroups id put params +func (o *V1HostgroupsIDPutParams) WithContext(ctx context.Context) *V1HostgroupsIDPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 hostgroups id put params +func (o *V1HostgroupsIDPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 hostgroups id put params +func (o *V1HostgroupsIDPutParams) WithHTTPClient(client *http.Client) *V1HostgroupsIDPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 hostgroups id put params +func (o *V1HostgroupsIDPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 hostgroups id put params +func (o *V1HostgroupsIDPutParams) WithBody(body *models.HostgroupShareOp) *V1HostgroupsIDPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 hostgroups id put params +func (o *V1HostgroupsIDPutParams) SetBody(body *models.HostgroupShareOp) { + o.Body = body +} + +// WithHostgroupID adds the hostgroupID to the v1 hostgroups id put params +func (o *V1HostgroupsIDPutParams) WithHostgroupID(hostgroupID string) *V1HostgroupsIDPutParams { + o.SetHostgroupID(hostgroupID) + return o +} + +// SetHostgroupID adds the hostgroupId to the v1 hostgroups id put params +func (o *V1HostgroupsIDPutParams) SetHostgroupID(hostgroupID string) { + o.HostgroupID = hostgroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1HostgroupsIDPutParams) 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 hostgroup_id + if err := r.SetPathParam("hostgroup_id", o.HostgroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/hostgroups/v1_hostgroups_id_put_responses.go b/power/client/hostgroups/v1_hostgroups_id_put_responses.go new file mode 100644 index 00000000..7557e45c --- /dev/null +++ b/power/client/hostgroups/v1_hostgroups_id_put_responses.go @@ -0,0 +1,621 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hostgroups + +// 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" +) + +// V1HostgroupsIDPutReader is a Reader for the V1HostgroupsIDPut structure. +type V1HostgroupsIDPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1HostgroupsIDPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1HostgroupsIDPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1HostgroupsIDPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1HostgroupsIDPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1HostgroupsIDPutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1HostgroupsIDPutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1HostgroupsIDPutConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1HostgroupsIDPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 504: + result := NewV1HostgroupsIDPutGatewayTimeout() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /v1/hostgroups/{hostgroup_id}] v1.hostgroups.id.put", response, response.Code()) + } +} + +// NewV1HostgroupsIDPutOK creates a V1HostgroupsIDPutOK with default headers values +func NewV1HostgroupsIDPutOK() *V1HostgroupsIDPutOK { + return &V1HostgroupsIDPutOK{} +} + +/* +V1HostgroupsIDPutOK describes a response with status code 200, with default header values. + +OK +*/ +type V1HostgroupsIDPutOK struct { + Payload *models.HostgroupWithSharingInfo +} + +// IsSuccess returns true when this v1 hostgroups Id put o k response has a 2xx status code +func (o *V1HostgroupsIDPutOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 hostgroups Id put o k response has a 3xx status code +func (o *V1HostgroupsIDPutOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups Id put o k response has a 4xx status code +func (o *V1HostgroupsIDPutOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hostgroups Id put o k response has a 5xx status code +func (o *V1HostgroupsIDPutOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hostgroups Id put o k response a status code equal to that given +func (o *V1HostgroupsIDPutOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 hostgroups Id put o k response +func (o *V1HostgroupsIDPutOK) Code() int { + return 200 +} + +func (o *V1HostgroupsIDPutOK) Error() string { + return fmt.Sprintf("[PUT /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdPutOK %+v", 200, o.Payload) +} + +func (o *V1HostgroupsIDPutOK) String() string { + return fmt.Sprintf("[PUT /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdPutOK %+v", 200, o.Payload) +} + +func (o *V1HostgroupsIDPutOK) GetPayload() *models.HostgroupWithSharingInfo { + return o.Payload +} + +func (o *V1HostgroupsIDPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HostgroupWithSharingInfo) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1HostgroupsIDPutBadRequest creates a V1HostgroupsIDPutBadRequest with default headers values +func NewV1HostgroupsIDPutBadRequest() *V1HostgroupsIDPutBadRequest { + return &V1HostgroupsIDPutBadRequest{} +} + +/* +V1HostgroupsIDPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1HostgroupsIDPutBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups Id put bad request response has a 2xx status code +func (o *V1HostgroupsIDPutBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups Id put bad request response has a 3xx status code +func (o *V1HostgroupsIDPutBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups Id put bad request response has a 4xx status code +func (o *V1HostgroupsIDPutBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hostgroups Id put bad request response has a 5xx status code +func (o *V1HostgroupsIDPutBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hostgroups Id put bad request response a status code equal to that given +func (o *V1HostgroupsIDPutBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 hostgroups Id put bad request response +func (o *V1HostgroupsIDPutBadRequest) Code() int { + return 400 +} + +func (o *V1HostgroupsIDPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdPutBadRequest %+v", 400, o.Payload) +} + +func (o *V1HostgroupsIDPutBadRequest) String() string { + return fmt.Sprintf("[PUT /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdPutBadRequest %+v", 400, o.Payload) +} + +func (o *V1HostgroupsIDPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsIDPutBadRequest) 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 +} + +// NewV1HostgroupsIDPutUnauthorized creates a V1HostgroupsIDPutUnauthorized with default headers values +func NewV1HostgroupsIDPutUnauthorized() *V1HostgroupsIDPutUnauthorized { + return &V1HostgroupsIDPutUnauthorized{} +} + +/* +V1HostgroupsIDPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1HostgroupsIDPutUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups Id put unauthorized response has a 2xx status code +func (o *V1HostgroupsIDPutUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups Id put unauthorized response has a 3xx status code +func (o *V1HostgroupsIDPutUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups Id put unauthorized response has a 4xx status code +func (o *V1HostgroupsIDPutUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hostgroups Id put unauthorized response has a 5xx status code +func (o *V1HostgroupsIDPutUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hostgroups Id put unauthorized response a status code equal to that given +func (o *V1HostgroupsIDPutUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 hostgroups Id put unauthorized response +func (o *V1HostgroupsIDPutUnauthorized) Code() int { + return 401 +} + +func (o *V1HostgroupsIDPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdPutUnauthorized %+v", 401, o.Payload) +} + +func (o *V1HostgroupsIDPutUnauthorized) String() string { + return fmt.Sprintf("[PUT /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdPutUnauthorized %+v", 401, o.Payload) +} + +func (o *V1HostgroupsIDPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsIDPutUnauthorized) 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 +} + +// NewV1HostgroupsIDPutForbidden creates a V1HostgroupsIDPutForbidden with default headers values +func NewV1HostgroupsIDPutForbidden() *V1HostgroupsIDPutForbidden { + return &V1HostgroupsIDPutForbidden{} +} + +/* +V1HostgroupsIDPutForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1HostgroupsIDPutForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups Id put forbidden response has a 2xx status code +func (o *V1HostgroupsIDPutForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups Id put forbidden response has a 3xx status code +func (o *V1HostgroupsIDPutForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups Id put forbidden response has a 4xx status code +func (o *V1HostgroupsIDPutForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hostgroups Id put forbidden response has a 5xx status code +func (o *V1HostgroupsIDPutForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hostgroups Id put forbidden response a status code equal to that given +func (o *V1HostgroupsIDPutForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 hostgroups Id put forbidden response +func (o *V1HostgroupsIDPutForbidden) Code() int { + return 403 +} + +func (o *V1HostgroupsIDPutForbidden) Error() string { + return fmt.Sprintf("[PUT /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdPutForbidden %+v", 403, o.Payload) +} + +func (o *V1HostgroupsIDPutForbidden) String() string { + return fmt.Sprintf("[PUT /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdPutForbidden %+v", 403, o.Payload) +} + +func (o *V1HostgroupsIDPutForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsIDPutForbidden) 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 +} + +// NewV1HostgroupsIDPutNotFound creates a V1HostgroupsIDPutNotFound with default headers values +func NewV1HostgroupsIDPutNotFound() *V1HostgroupsIDPutNotFound { + return &V1HostgroupsIDPutNotFound{} +} + +/* +V1HostgroupsIDPutNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1HostgroupsIDPutNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups Id put not found response has a 2xx status code +func (o *V1HostgroupsIDPutNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups Id put not found response has a 3xx status code +func (o *V1HostgroupsIDPutNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups Id put not found response has a 4xx status code +func (o *V1HostgroupsIDPutNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hostgroups Id put not found response has a 5xx status code +func (o *V1HostgroupsIDPutNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hostgroups Id put not found response a status code equal to that given +func (o *V1HostgroupsIDPutNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 hostgroups Id put not found response +func (o *V1HostgroupsIDPutNotFound) Code() int { + return 404 +} + +func (o *V1HostgroupsIDPutNotFound) Error() string { + return fmt.Sprintf("[PUT /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdPutNotFound %+v", 404, o.Payload) +} + +func (o *V1HostgroupsIDPutNotFound) String() string { + return fmt.Sprintf("[PUT /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdPutNotFound %+v", 404, o.Payload) +} + +func (o *V1HostgroupsIDPutNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsIDPutNotFound) 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 +} + +// NewV1HostgroupsIDPutConflict creates a V1HostgroupsIDPutConflict with default headers values +func NewV1HostgroupsIDPutConflict() *V1HostgroupsIDPutConflict { + return &V1HostgroupsIDPutConflict{} +} + +/* +V1HostgroupsIDPutConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1HostgroupsIDPutConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups Id put conflict response has a 2xx status code +func (o *V1HostgroupsIDPutConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups Id put conflict response has a 3xx status code +func (o *V1HostgroupsIDPutConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups Id put conflict response has a 4xx status code +func (o *V1HostgroupsIDPutConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hostgroups Id put conflict response has a 5xx status code +func (o *V1HostgroupsIDPutConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hostgroups Id put conflict response a status code equal to that given +func (o *V1HostgroupsIDPutConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 hostgroups Id put conflict response +func (o *V1HostgroupsIDPutConflict) Code() int { + return 409 +} + +func (o *V1HostgroupsIDPutConflict) Error() string { + return fmt.Sprintf("[PUT /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdPutConflict %+v", 409, o.Payload) +} + +func (o *V1HostgroupsIDPutConflict) String() string { + return fmt.Sprintf("[PUT /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdPutConflict %+v", 409, o.Payload) +} + +func (o *V1HostgroupsIDPutConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsIDPutConflict) 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 +} + +// NewV1HostgroupsIDPutInternalServerError creates a V1HostgroupsIDPutInternalServerError with default headers values +func NewV1HostgroupsIDPutInternalServerError() *V1HostgroupsIDPutInternalServerError { + return &V1HostgroupsIDPutInternalServerError{} +} + +/* +V1HostgroupsIDPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1HostgroupsIDPutInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups Id put internal server error response has a 2xx status code +func (o *V1HostgroupsIDPutInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups Id put internal server error response has a 3xx status code +func (o *V1HostgroupsIDPutInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups Id put internal server error response has a 4xx status code +func (o *V1HostgroupsIDPutInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hostgroups Id put internal server error response has a 5xx status code +func (o *V1HostgroupsIDPutInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 hostgroups Id put internal server error response a status code equal to that given +func (o *V1HostgroupsIDPutInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 hostgroups Id put internal server error response +func (o *V1HostgroupsIDPutInternalServerError) Code() int { + return 500 +} + +func (o *V1HostgroupsIDPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdPutInternalServerError %+v", 500, o.Payload) +} + +func (o *V1HostgroupsIDPutInternalServerError) String() string { + return fmt.Sprintf("[PUT /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdPutInternalServerError %+v", 500, o.Payload) +} + +func (o *V1HostgroupsIDPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsIDPutInternalServerError) 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 +} + +// NewV1HostgroupsIDPutGatewayTimeout creates a V1HostgroupsIDPutGatewayTimeout with default headers values +func NewV1HostgroupsIDPutGatewayTimeout() *V1HostgroupsIDPutGatewayTimeout { + return &V1HostgroupsIDPutGatewayTimeout{} +} + +/* +V1HostgroupsIDPutGatewayTimeout describes a response with status code 504, with default header values. + +Gateway Timeout. Request is still processing and taking longer than expected. +*/ +type V1HostgroupsIDPutGatewayTimeout struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups Id put gateway timeout response has a 2xx status code +func (o *V1HostgroupsIDPutGatewayTimeout) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups Id put gateway timeout response has a 3xx status code +func (o *V1HostgroupsIDPutGatewayTimeout) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups Id put gateway timeout response has a 4xx status code +func (o *V1HostgroupsIDPutGatewayTimeout) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hostgroups Id put gateway timeout response has a 5xx status code +func (o *V1HostgroupsIDPutGatewayTimeout) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 hostgroups Id put gateway timeout response a status code equal to that given +func (o *V1HostgroupsIDPutGatewayTimeout) IsCode(code int) bool { + return code == 504 +} + +// Code gets the status code for the v1 hostgroups Id put gateway timeout response +func (o *V1HostgroupsIDPutGatewayTimeout) Code() int { + return 504 +} + +func (o *V1HostgroupsIDPutGatewayTimeout) Error() string { + return fmt.Sprintf("[PUT /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdPutGatewayTimeout %+v", 504, o.Payload) +} + +func (o *V1HostgroupsIDPutGatewayTimeout) String() string { + return fmt.Sprintf("[PUT /v1/hostgroups/{hostgroup_id}][%d] v1HostgroupsIdPutGatewayTimeout %+v", 504, o.Payload) +} + +func (o *V1HostgroupsIDPutGatewayTimeout) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsIDPutGatewayTimeout) 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/hostgroups/v1_hostgroups_post_parameters.go b/power/client/hostgroups/v1_hostgroups_post_parameters.go new file mode 100644 index 00000000..56fe0baa --- /dev/null +++ b/power/client/hostgroups/v1_hostgroups_post_parameters.go @@ -0,0 +1,153 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hostgroups + +// 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" +) + +// NewV1HostgroupsPostParams creates a new V1HostgroupsPostParams 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 NewV1HostgroupsPostParams() *V1HostgroupsPostParams { + return &V1HostgroupsPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1HostgroupsPostParamsWithTimeout creates a new V1HostgroupsPostParams object +// with the ability to set a timeout on a request. +func NewV1HostgroupsPostParamsWithTimeout(timeout time.Duration) *V1HostgroupsPostParams { + return &V1HostgroupsPostParams{ + timeout: timeout, + } +} + +// NewV1HostgroupsPostParamsWithContext creates a new V1HostgroupsPostParams object +// with the ability to set a context for a request. +func NewV1HostgroupsPostParamsWithContext(ctx context.Context) *V1HostgroupsPostParams { + return &V1HostgroupsPostParams{ + Context: ctx, + } +} + +// NewV1HostgroupsPostParamsWithHTTPClient creates a new V1HostgroupsPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1HostgroupsPostParamsWithHTTPClient(client *http.Client) *V1HostgroupsPostParams { + return &V1HostgroupsPostParams{ + HTTPClient: client, + } +} + +/* +V1HostgroupsPostParams contains all the parameters to send to the API endpoint + + for the v1 hostgroups post operation. + + Typically these are written to a http.Request. +*/ +type V1HostgroupsPostParams struct { + + /* Body. + + Parameters for the creation of a new hostgroup + */ + Body *models.HostgroupCreate + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 hostgroups post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1HostgroupsPostParams) WithDefaults() *V1HostgroupsPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 hostgroups post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1HostgroupsPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 hostgroups post params +func (o *V1HostgroupsPostParams) WithTimeout(timeout time.Duration) *V1HostgroupsPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 hostgroups post params +func (o *V1HostgroupsPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 hostgroups post params +func (o *V1HostgroupsPostParams) WithContext(ctx context.Context) *V1HostgroupsPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 hostgroups post params +func (o *V1HostgroupsPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 hostgroups post params +func (o *V1HostgroupsPostParams) WithHTTPClient(client *http.Client) *V1HostgroupsPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 hostgroups post params +func (o *V1HostgroupsPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 hostgroups post params +func (o *V1HostgroupsPostParams) WithBody(body *models.HostgroupCreate) *V1HostgroupsPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 hostgroups post params +func (o *V1HostgroupsPostParams) SetBody(body *models.HostgroupCreate) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *V1HostgroupsPostParams) 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 + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/hostgroups/v1_hostgroups_post_responses.go b/power/client/hostgroups/v1_hostgroups_post_responses.go new file mode 100644 index 00000000..81b051bb --- /dev/null +++ b/power/client/hostgroups/v1_hostgroups_post_responses.go @@ -0,0 +1,621 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hostgroups + +// 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" +) + +// V1HostgroupsPostReader is a Reader for the V1HostgroupsPost structure. +type V1HostgroupsPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1HostgroupsPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 201: + result := NewV1HostgroupsPostCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1HostgroupsPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1HostgroupsPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1HostgroupsPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1HostgroupsPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewV1HostgroupsPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1HostgroupsPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 504: + result := NewV1HostgroupsPostGatewayTimeout() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /v1/hostgroups] v1.hostgroups.post", response, response.Code()) + } +} + +// NewV1HostgroupsPostCreated creates a V1HostgroupsPostCreated with default headers values +func NewV1HostgroupsPostCreated() *V1HostgroupsPostCreated { + return &V1HostgroupsPostCreated{} +} + +/* +V1HostgroupsPostCreated describes a response with status code 201, with default header values. + +Created +*/ +type V1HostgroupsPostCreated struct { + Payload *models.Hostgroup +} + +// IsSuccess returns true when this v1 hostgroups post created response has a 2xx status code +func (o *V1HostgroupsPostCreated) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 hostgroups post created response has a 3xx status code +func (o *V1HostgroupsPostCreated) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups post created response has a 4xx status code +func (o *V1HostgroupsPostCreated) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hostgroups post created response has a 5xx status code +func (o *V1HostgroupsPostCreated) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hostgroups post created response a status code equal to that given +func (o *V1HostgroupsPostCreated) IsCode(code int) bool { + return code == 201 +} + +// Code gets the status code for the v1 hostgroups post created response +func (o *V1HostgroupsPostCreated) Code() int { + return 201 +} + +func (o *V1HostgroupsPostCreated) Error() string { + return fmt.Sprintf("[POST /v1/hostgroups][%d] v1HostgroupsPostCreated %+v", 201, o.Payload) +} + +func (o *V1HostgroupsPostCreated) String() string { + return fmt.Sprintf("[POST /v1/hostgroups][%d] v1HostgroupsPostCreated %+v", 201, o.Payload) +} + +func (o *V1HostgroupsPostCreated) GetPayload() *models.Hostgroup { + return o.Payload +} + +func (o *V1HostgroupsPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Hostgroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1HostgroupsPostBadRequest creates a V1HostgroupsPostBadRequest with default headers values +func NewV1HostgroupsPostBadRequest() *V1HostgroupsPostBadRequest { + return &V1HostgroupsPostBadRequest{} +} + +/* +V1HostgroupsPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1HostgroupsPostBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups post bad request response has a 2xx status code +func (o *V1HostgroupsPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups post bad request response has a 3xx status code +func (o *V1HostgroupsPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups post bad request response has a 4xx status code +func (o *V1HostgroupsPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hostgroups post bad request response has a 5xx status code +func (o *V1HostgroupsPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hostgroups post bad request response a status code equal to that given +func (o *V1HostgroupsPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 hostgroups post bad request response +func (o *V1HostgroupsPostBadRequest) Code() int { + return 400 +} + +func (o *V1HostgroupsPostBadRequest) Error() string { + return fmt.Sprintf("[POST /v1/hostgroups][%d] v1HostgroupsPostBadRequest %+v", 400, o.Payload) +} + +func (o *V1HostgroupsPostBadRequest) String() string { + return fmt.Sprintf("[POST /v1/hostgroups][%d] v1HostgroupsPostBadRequest %+v", 400, o.Payload) +} + +func (o *V1HostgroupsPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsPostBadRequest) 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 +} + +// NewV1HostgroupsPostUnauthorized creates a V1HostgroupsPostUnauthorized with default headers values +func NewV1HostgroupsPostUnauthorized() *V1HostgroupsPostUnauthorized { + return &V1HostgroupsPostUnauthorized{} +} + +/* +V1HostgroupsPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1HostgroupsPostUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups post unauthorized response has a 2xx status code +func (o *V1HostgroupsPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups post unauthorized response has a 3xx status code +func (o *V1HostgroupsPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups post unauthorized response has a 4xx status code +func (o *V1HostgroupsPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hostgroups post unauthorized response has a 5xx status code +func (o *V1HostgroupsPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hostgroups post unauthorized response a status code equal to that given +func (o *V1HostgroupsPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 hostgroups post unauthorized response +func (o *V1HostgroupsPostUnauthorized) Code() int { + return 401 +} + +func (o *V1HostgroupsPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /v1/hostgroups][%d] v1HostgroupsPostUnauthorized %+v", 401, o.Payload) +} + +func (o *V1HostgroupsPostUnauthorized) String() string { + return fmt.Sprintf("[POST /v1/hostgroups][%d] v1HostgroupsPostUnauthorized %+v", 401, o.Payload) +} + +func (o *V1HostgroupsPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsPostUnauthorized) 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 +} + +// NewV1HostgroupsPostForbidden creates a V1HostgroupsPostForbidden with default headers values +func NewV1HostgroupsPostForbidden() *V1HostgroupsPostForbidden { + return &V1HostgroupsPostForbidden{} +} + +/* +V1HostgroupsPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1HostgroupsPostForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups post forbidden response has a 2xx status code +func (o *V1HostgroupsPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups post forbidden response has a 3xx status code +func (o *V1HostgroupsPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups post forbidden response has a 4xx status code +func (o *V1HostgroupsPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hostgroups post forbidden response has a 5xx status code +func (o *V1HostgroupsPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hostgroups post forbidden response a status code equal to that given +func (o *V1HostgroupsPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 hostgroups post forbidden response +func (o *V1HostgroupsPostForbidden) Code() int { + return 403 +} + +func (o *V1HostgroupsPostForbidden) Error() string { + return fmt.Sprintf("[POST /v1/hostgroups][%d] v1HostgroupsPostForbidden %+v", 403, o.Payload) +} + +func (o *V1HostgroupsPostForbidden) String() string { + return fmt.Sprintf("[POST /v1/hostgroups][%d] v1HostgroupsPostForbidden %+v", 403, o.Payload) +} + +func (o *V1HostgroupsPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsPostForbidden) 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 +} + +// NewV1HostgroupsPostConflict creates a V1HostgroupsPostConflict with default headers values +func NewV1HostgroupsPostConflict() *V1HostgroupsPostConflict { + return &V1HostgroupsPostConflict{} +} + +/* +V1HostgroupsPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1HostgroupsPostConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups post conflict response has a 2xx status code +func (o *V1HostgroupsPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups post conflict response has a 3xx status code +func (o *V1HostgroupsPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups post conflict response has a 4xx status code +func (o *V1HostgroupsPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hostgroups post conflict response has a 5xx status code +func (o *V1HostgroupsPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hostgroups post conflict response a status code equal to that given +func (o *V1HostgroupsPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 hostgroups post conflict response +func (o *V1HostgroupsPostConflict) Code() int { + return 409 +} + +func (o *V1HostgroupsPostConflict) Error() string { + return fmt.Sprintf("[POST /v1/hostgroups][%d] v1HostgroupsPostConflict %+v", 409, o.Payload) +} + +func (o *V1HostgroupsPostConflict) String() string { + return fmt.Sprintf("[POST /v1/hostgroups][%d] v1HostgroupsPostConflict %+v", 409, o.Payload) +} + +func (o *V1HostgroupsPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsPostConflict) 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 +} + +// NewV1HostgroupsPostUnprocessableEntity creates a V1HostgroupsPostUnprocessableEntity with default headers values +func NewV1HostgroupsPostUnprocessableEntity() *V1HostgroupsPostUnprocessableEntity { + return &V1HostgroupsPostUnprocessableEntity{} +} + +/* +V1HostgroupsPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type V1HostgroupsPostUnprocessableEntity struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups post unprocessable entity response has a 2xx status code +func (o *V1HostgroupsPostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups post unprocessable entity response has a 3xx status code +func (o *V1HostgroupsPostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups post unprocessable entity response has a 4xx status code +func (o *V1HostgroupsPostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hostgroups post unprocessable entity response has a 5xx status code +func (o *V1HostgroupsPostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hostgroups post unprocessable entity response a status code equal to that given +func (o *V1HostgroupsPostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the v1 hostgroups post unprocessable entity response +func (o *V1HostgroupsPostUnprocessableEntity) Code() int { + return 422 +} + +func (o *V1HostgroupsPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /v1/hostgroups][%d] v1HostgroupsPostUnprocessableEntity %+v", 422, o.Payload) +} + +func (o *V1HostgroupsPostUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /v1/hostgroups][%d] v1HostgroupsPostUnprocessableEntity %+v", 422, o.Payload) +} + +func (o *V1HostgroupsPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsPostUnprocessableEntity) 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 +} + +// NewV1HostgroupsPostInternalServerError creates a V1HostgroupsPostInternalServerError with default headers values +func NewV1HostgroupsPostInternalServerError() *V1HostgroupsPostInternalServerError { + return &V1HostgroupsPostInternalServerError{} +} + +/* +V1HostgroupsPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1HostgroupsPostInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups post internal server error response has a 2xx status code +func (o *V1HostgroupsPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups post internal server error response has a 3xx status code +func (o *V1HostgroupsPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups post internal server error response has a 4xx status code +func (o *V1HostgroupsPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hostgroups post internal server error response has a 5xx status code +func (o *V1HostgroupsPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 hostgroups post internal server error response a status code equal to that given +func (o *V1HostgroupsPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 hostgroups post internal server error response +func (o *V1HostgroupsPostInternalServerError) Code() int { + return 500 +} + +func (o *V1HostgroupsPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /v1/hostgroups][%d] v1HostgroupsPostInternalServerError %+v", 500, o.Payload) +} + +func (o *V1HostgroupsPostInternalServerError) String() string { + return fmt.Sprintf("[POST /v1/hostgroups][%d] v1HostgroupsPostInternalServerError %+v", 500, o.Payload) +} + +func (o *V1HostgroupsPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsPostInternalServerError) 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 +} + +// NewV1HostgroupsPostGatewayTimeout creates a V1HostgroupsPostGatewayTimeout with default headers values +func NewV1HostgroupsPostGatewayTimeout() *V1HostgroupsPostGatewayTimeout { + return &V1HostgroupsPostGatewayTimeout{} +} + +/* +V1HostgroupsPostGatewayTimeout describes a response with status code 504, with default header values. + +Gateway Timeout. Request is still processing and taking longer than expected. +*/ +type V1HostgroupsPostGatewayTimeout struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hostgroups post gateway timeout response has a 2xx status code +func (o *V1HostgroupsPostGatewayTimeout) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hostgroups post gateway timeout response has a 3xx status code +func (o *V1HostgroupsPostGatewayTimeout) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hostgroups post gateway timeout response has a 4xx status code +func (o *V1HostgroupsPostGatewayTimeout) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hostgroups post gateway timeout response has a 5xx status code +func (o *V1HostgroupsPostGatewayTimeout) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 hostgroups post gateway timeout response a status code equal to that given +func (o *V1HostgroupsPostGatewayTimeout) IsCode(code int) bool { + return code == 504 +} + +// Code gets the status code for the v1 hostgroups post gateway timeout response +func (o *V1HostgroupsPostGatewayTimeout) Code() int { + return 504 +} + +func (o *V1HostgroupsPostGatewayTimeout) Error() string { + return fmt.Sprintf("[POST /v1/hostgroups][%d] v1HostgroupsPostGatewayTimeout %+v", 504, o.Payload) +} + +func (o *V1HostgroupsPostGatewayTimeout) String() string { + return fmt.Sprintf("[POST /v1/hostgroups][%d] v1HostgroupsPostGatewayTimeout %+v", 504, o.Payload) +} + +func (o *V1HostgroupsPostGatewayTimeout) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostgroupsPostGatewayTimeout) 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/hostgroups/v1_hosts_get_parameters.go b/power/client/hostgroups/v1_hosts_get_parameters.go new file mode 100644 index 00000000..b2b9e6c7 --- /dev/null +++ b/power/client/hostgroups/v1_hosts_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hostgroups + +// 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" +) + +// NewV1HostsGetParams creates a new V1HostsGetParams 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 NewV1HostsGetParams() *V1HostsGetParams { + return &V1HostsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1HostsGetParamsWithTimeout creates a new V1HostsGetParams object +// with the ability to set a timeout on a request. +func NewV1HostsGetParamsWithTimeout(timeout time.Duration) *V1HostsGetParams { + return &V1HostsGetParams{ + timeout: timeout, + } +} + +// NewV1HostsGetParamsWithContext creates a new V1HostsGetParams object +// with the ability to set a context for a request. +func NewV1HostsGetParamsWithContext(ctx context.Context) *V1HostsGetParams { + return &V1HostsGetParams{ + Context: ctx, + } +} + +// NewV1HostsGetParamsWithHTTPClient creates a new V1HostsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1HostsGetParamsWithHTTPClient(client *http.Client) *V1HostsGetParams { + return &V1HostsGetParams{ + HTTPClient: client, + } +} + +/* +V1HostsGetParams contains all the parameters to send to the API endpoint + + for the v1 hosts get operation. + + Typically these are written to a http.Request. +*/ +type V1HostsGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 hosts get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1HostsGetParams) WithDefaults() *V1HostsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 hosts get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1HostsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 hosts get params +func (o *V1HostsGetParams) WithTimeout(timeout time.Duration) *V1HostsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 hosts get params +func (o *V1HostsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 hosts get params +func (o *V1HostsGetParams) WithContext(ctx context.Context) *V1HostsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 hosts get params +func (o *V1HostsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 hosts get params +func (o *V1HostsGetParams) WithHTTPClient(client *http.Client) *V1HostsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 hosts get params +func (o *V1HostsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *V1HostsGetParams) 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/hostgroups/v1_hosts_get_responses.go b/power/client/hostgroups/v1_hosts_get_responses.go new file mode 100644 index 00000000..80e385ed --- /dev/null +++ b/power/client/hostgroups/v1_hosts_get_responses.go @@ -0,0 +1,471 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hostgroups + +// 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" +) + +// V1HostsGetReader is a Reader for the V1HostsGet structure. +type V1HostsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1HostsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1HostsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1HostsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1HostsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1HostsGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1HostsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 504: + result := NewV1HostsGetGatewayTimeout() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/hosts] v1.hosts.get", response, response.Code()) + } +} + +// NewV1HostsGetOK creates a V1HostsGetOK with default headers values +func NewV1HostsGetOK() *V1HostsGetOK { + return &V1HostsGetOK{} +} + +/* +V1HostsGetOK describes a response with status code 200, with default header values. + +OK +*/ +type V1HostsGetOK struct { + Payload models.HostList +} + +// IsSuccess returns true when this v1 hosts get o k response has a 2xx status code +func (o *V1HostsGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 hosts get o k response has a 3xx status code +func (o *V1HostsGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts get o k response has a 4xx status code +func (o *V1HostsGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hosts get o k response has a 5xx status code +func (o *V1HostsGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts get o k response a status code equal to that given +func (o *V1HostsGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 hosts get o k response +func (o *V1HostsGetOK) Code() int { + return 200 +} + +func (o *V1HostsGetOK) Error() string { + return fmt.Sprintf("[GET /v1/hosts][%d] v1HostsGetOK %+v", 200, o.Payload) +} + +func (o *V1HostsGetOK) String() string { + return fmt.Sprintf("[GET /v1/hosts][%d] v1HostsGetOK %+v", 200, o.Payload) +} + +func (o *V1HostsGetOK) GetPayload() models.HostList { + return o.Payload +} + +func (o *V1HostsGetOK) 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 +} + +// NewV1HostsGetBadRequest creates a V1HostsGetBadRequest with default headers values +func NewV1HostsGetBadRequest() *V1HostsGetBadRequest { + return &V1HostsGetBadRequest{} +} + +/* +V1HostsGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1HostsGetBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts get bad request response has a 2xx status code +func (o *V1HostsGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts get bad request response has a 3xx status code +func (o *V1HostsGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts get bad request response has a 4xx status code +func (o *V1HostsGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hosts get bad request response has a 5xx status code +func (o *V1HostsGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts get bad request response a status code equal to that given +func (o *V1HostsGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 hosts get bad request response +func (o *V1HostsGetBadRequest) Code() int { + return 400 +} + +func (o *V1HostsGetBadRequest) Error() string { + return fmt.Sprintf("[GET /v1/hosts][%d] v1HostsGetBadRequest %+v", 400, o.Payload) +} + +func (o *V1HostsGetBadRequest) String() string { + return fmt.Sprintf("[GET /v1/hosts][%d] v1HostsGetBadRequest %+v", 400, o.Payload) +} + +func (o *V1HostsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsGetBadRequest) 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 +} + +// NewV1HostsGetUnauthorized creates a V1HostsGetUnauthorized with default headers values +func NewV1HostsGetUnauthorized() *V1HostsGetUnauthorized { + return &V1HostsGetUnauthorized{} +} + +/* +V1HostsGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1HostsGetUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts get unauthorized response has a 2xx status code +func (o *V1HostsGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts get unauthorized response has a 3xx status code +func (o *V1HostsGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts get unauthorized response has a 4xx status code +func (o *V1HostsGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hosts get unauthorized response has a 5xx status code +func (o *V1HostsGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts get unauthorized response a status code equal to that given +func (o *V1HostsGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 hosts get unauthorized response +func (o *V1HostsGetUnauthorized) Code() int { + return 401 +} + +func (o *V1HostsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /v1/hosts][%d] v1HostsGetUnauthorized %+v", 401, o.Payload) +} + +func (o *V1HostsGetUnauthorized) String() string { + return fmt.Sprintf("[GET /v1/hosts][%d] v1HostsGetUnauthorized %+v", 401, o.Payload) +} + +func (o *V1HostsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsGetUnauthorized) 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 +} + +// NewV1HostsGetForbidden creates a V1HostsGetForbidden with default headers values +func NewV1HostsGetForbidden() *V1HostsGetForbidden { + return &V1HostsGetForbidden{} +} + +/* +V1HostsGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1HostsGetForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts get forbidden response has a 2xx status code +func (o *V1HostsGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts get forbidden response has a 3xx status code +func (o *V1HostsGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts get forbidden response has a 4xx status code +func (o *V1HostsGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hosts get forbidden response has a 5xx status code +func (o *V1HostsGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts get forbidden response a status code equal to that given +func (o *V1HostsGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 hosts get forbidden response +func (o *V1HostsGetForbidden) Code() int { + return 403 +} + +func (o *V1HostsGetForbidden) Error() string { + return fmt.Sprintf("[GET /v1/hosts][%d] v1HostsGetForbidden %+v", 403, o.Payload) +} + +func (o *V1HostsGetForbidden) String() string { + return fmt.Sprintf("[GET /v1/hosts][%d] v1HostsGetForbidden %+v", 403, o.Payload) +} + +func (o *V1HostsGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsGetForbidden) 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 +} + +// NewV1HostsGetInternalServerError creates a V1HostsGetInternalServerError with default headers values +func NewV1HostsGetInternalServerError() *V1HostsGetInternalServerError { + return &V1HostsGetInternalServerError{} +} + +/* +V1HostsGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1HostsGetInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts get internal server error response has a 2xx status code +func (o *V1HostsGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts get internal server error response has a 3xx status code +func (o *V1HostsGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts get internal server error response has a 4xx status code +func (o *V1HostsGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hosts get internal server error response has a 5xx status code +func (o *V1HostsGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 hosts get internal server error response a status code equal to that given +func (o *V1HostsGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 hosts get internal server error response +func (o *V1HostsGetInternalServerError) Code() int { + return 500 +} + +func (o *V1HostsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /v1/hosts][%d] v1HostsGetInternalServerError %+v", 500, o.Payload) +} + +func (o *V1HostsGetInternalServerError) String() string { + return fmt.Sprintf("[GET /v1/hosts][%d] v1HostsGetInternalServerError %+v", 500, o.Payload) +} + +func (o *V1HostsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsGetInternalServerError) 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 +} + +// NewV1HostsGetGatewayTimeout creates a V1HostsGetGatewayTimeout with default headers values +func NewV1HostsGetGatewayTimeout() *V1HostsGetGatewayTimeout { + return &V1HostsGetGatewayTimeout{} +} + +/* +V1HostsGetGatewayTimeout describes a response with status code 504, with default header values. + +Gateway Timeout. Request is still processing and taking longer than expected. +*/ +type V1HostsGetGatewayTimeout struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts get gateway timeout response has a 2xx status code +func (o *V1HostsGetGatewayTimeout) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts get gateway timeout response has a 3xx status code +func (o *V1HostsGetGatewayTimeout) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts get gateway timeout response has a 4xx status code +func (o *V1HostsGetGatewayTimeout) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hosts get gateway timeout response has a 5xx status code +func (o *V1HostsGetGatewayTimeout) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 hosts get gateway timeout response a status code equal to that given +func (o *V1HostsGetGatewayTimeout) IsCode(code int) bool { + return code == 504 +} + +// Code gets the status code for the v1 hosts get gateway timeout response +func (o *V1HostsGetGatewayTimeout) Code() int { + return 504 +} + +func (o *V1HostsGetGatewayTimeout) Error() string { + return fmt.Sprintf("[GET /v1/hosts][%d] v1HostsGetGatewayTimeout %+v", 504, o.Payload) +} + +func (o *V1HostsGetGatewayTimeout) String() string { + return fmt.Sprintf("[GET /v1/hosts][%d] v1HostsGetGatewayTimeout %+v", 504, o.Payload) +} + +func (o *V1HostsGetGatewayTimeout) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsGetGatewayTimeout) 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/hostgroups/v1_hosts_id_delete_parameters.go b/power/client/hostgroups/v1_hosts_id_delete_parameters.go new file mode 100644 index 00000000..e2508c8d --- /dev/null +++ b/power/client/hostgroups/v1_hosts_id_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hostgroups + +// 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" +) + +// NewV1HostsIDDeleteParams creates a new V1HostsIDDeleteParams 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 NewV1HostsIDDeleteParams() *V1HostsIDDeleteParams { + return &V1HostsIDDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1HostsIDDeleteParamsWithTimeout creates a new V1HostsIDDeleteParams object +// with the ability to set a timeout on a request. +func NewV1HostsIDDeleteParamsWithTimeout(timeout time.Duration) *V1HostsIDDeleteParams { + return &V1HostsIDDeleteParams{ + timeout: timeout, + } +} + +// NewV1HostsIDDeleteParamsWithContext creates a new V1HostsIDDeleteParams object +// with the ability to set a context for a request. +func NewV1HostsIDDeleteParamsWithContext(ctx context.Context) *V1HostsIDDeleteParams { + return &V1HostsIDDeleteParams{ + Context: ctx, + } +} + +// NewV1HostsIDDeleteParamsWithHTTPClient creates a new V1HostsIDDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1HostsIDDeleteParamsWithHTTPClient(client *http.Client) *V1HostsIDDeleteParams { + return &V1HostsIDDeleteParams{ + HTTPClient: client, + } +} + +/* +V1HostsIDDeleteParams contains all the parameters to send to the API endpoint + + for the v1 hosts id delete operation. + + Typically these are written to a http.Request. +*/ +type V1HostsIDDeleteParams struct { + + /* HostID. + + Host ID + */ + HostID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 hosts id delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1HostsIDDeleteParams) WithDefaults() *V1HostsIDDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 hosts id delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1HostsIDDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 hosts id delete params +func (o *V1HostsIDDeleteParams) WithTimeout(timeout time.Duration) *V1HostsIDDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 hosts id delete params +func (o *V1HostsIDDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 hosts id delete params +func (o *V1HostsIDDeleteParams) WithContext(ctx context.Context) *V1HostsIDDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 hosts id delete params +func (o *V1HostsIDDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 hosts id delete params +func (o *V1HostsIDDeleteParams) WithHTTPClient(client *http.Client) *V1HostsIDDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 hosts id delete params +func (o *V1HostsIDDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithHostID adds the hostID to the v1 hosts id delete params +func (o *V1HostsIDDeleteParams) WithHostID(hostID string) *V1HostsIDDeleteParams { + o.SetHostID(hostID) + return o +} + +// SetHostID adds the hostId to the v1 hosts id delete params +func (o *V1HostsIDDeleteParams) SetHostID(hostID string) { + o.HostID = hostID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1HostsIDDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param host_id + if err := r.SetPathParam("host_id", o.HostID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/hostgroups/v1_hosts_id_delete_responses.go b/power/client/hostgroups/v1_hosts_id_delete_responses.go new file mode 100644 index 00000000..e41a8ea2 --- /dev/null +++ b/power/client/hostgroups/v1_hosts_id_delete_responses.go @@ -0,0 +1,545 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hostgroups + +// 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" +) + +// V1HostsIDDeleteReader is a Reader for the V1HostsIDDelete structure. +type V1HostsIDDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1HostsIDDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewV1HostsIDDeleteAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1HostsIDDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1HostsIDDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1HostsIDDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1HostsIDDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1HostsIDDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 504: + result := NewV1HostsIDDeleteGatewayTimeout() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /v1/hosts/{host_id}] v1.hosts.id.delete", response, response.Code()) + } +} + +// NewV1HostsIDDeleteAccepted creates a V1HostsIDDeleteAccepted with default headers values +func NewV1HostsIDDeleteAccepted() *V1HostsIDDeleteAccepted { + return &V1HostsIDDeleteAccepted{} +} + +/* +V1HostsIDDeleteAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type V1HostsIDDeleteAccepted struct { + Payload models.Object +} + +// IsSuccess returns true when this v1 hosts Id delete accepted response has a 2xx status code +func (o *V1HostsIDDeleteAccepted) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 hosts Id delete accepted response has a 3xx status code +func (o *V1HostsIDDeleteAccepted) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id delete accepted response has a 4xx status code +func (o *V1HostsIDDeleteAccepted) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hosts Id delete accepted response has a 5xx status code +func (o *V1HostsIDDeleteAccepted) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts Id delete accepted response a status code equal to that given +func (o *V1HostsIDDeleteAccepted) IsCode(code int) bool { + return code == 202 +} + +// Code gets the status code for the v1 hosts Id delete accepted response +func (o *V1HostsIDDeleteAccepted) Code() int { + return 202 +} + +func (o *V1HostsIDDeleteAccepted) Error() string { + return fmt.Sprintf("[DELETE /v1/hosts/{host_id}][%d] v1HostsIdDeleteAccepted %+v", 202, o.Payload) +} + +func (o *V1HostsIDDeleteAccepted) String() string { + return fmt.Sprintf("[DELETE /v1/hosts/{host_id}][%d] v1HostsIdDeleteAccepted %+v", 202, o.Payload) +} + +func (o *V1HostsIDDeleteAccepted) GetPayload() models.Object { + return o.Payload +} + +func (o *V1HostsIDDeleteAccepted) 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 +} + +// NewV1HostsIDDeleteBadRequest creates a V1HostsIDDeleteBadRequest with default headers values +func NewV1HostsIDDeleteBadRequest() *V1HostsIDDeleteBadRequest { + return &V1HostsIDDeleteBadRequest{} +} + +/* +V1HostsIDDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1HostsIDDeleteBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts Id delete bad request response has a 2xx status code +func (o *V1HostsIDDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts Id delete bad request response has a 3xx status code +func (o *V1HostsIDDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id delete bad request response has a 4xx status code +func (o *V1HostsIDDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hosts Id delete bad request response has a 5xx status code +func (o *V1HostsIDDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts Id delete bad request response a status code equal to that given +func (o *V1HostsIDDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 hosts Id delete bad request response +func (o *V1HostsIDDeleteBadRequest) Code() int { + return 400 +} + +func (o *V1HostsIDDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /v1/hosts/{host_id}][%d] v1HostsIdDeleteBadRequest %+v", 400, o.Payload) +} + +func (o *V1HostsIDDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /v1/hosts/{host_id}][%d] v1HostsIdDeleteBadRequest %+v", 400, o.Payload) +} + +func (o *V1HostsIDDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsIDDeleteBadRequest) 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 +} + +// NewV1HostsIDDeleteUnauthorized creates a V1HostsIDDeleteUnauthorized with default headers values +func NewV1HostsIDDeleteUnauthorized() *V1HostsIDDeleteUnauthorized { + return &V1HostsIDDeleteUnauthorized{} +} + +/* +V1HostsIDDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1HostsIDDeleteUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts Id delete unauthorized response has a 2xx status code +func (o *V1HostsIDDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts Id delete unauthorized response has a 3xx status code +func (o *V1HostsIDDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id delete unauthorized response has a 4xx status code +func (o *V1HostsIDDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hosts Id delete unauthorized response has a 5xx status code +func (o *V1HostsIDDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts Id delete unauthorized response a status code equal to that given +func (o *V1HostsIDDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 hosts Id delete unauthorized response +func (o *V1HostsIDDeleteUnauthorized) Code() int { + return 401 +} + +func (o *V1HostsIDDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /v1/hosts/{host_id}][%d] v1HostsIdDeleteUnauthorized %+v", 401, o.Payload) +} + +func (o *V1HostsIDDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /v1/hosts/{host_id}][%d] v1HostsIdDeleteUnauthorized %+v", 401, o.Payload) +} + +func (o *V1HostsIDDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsIDDeleteUnauthorized) 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 +} + +// NewV1HostsIDDeleteForbidden creates a V1HostsIDDeleteForbidden with default headers values +func NewV1HostsIDDeleteForbidden() *V1HostsIDDeleteForbidden { + return &V1HostsIDDeleteForbidden{} +} + +/* +V1HostsIDDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1HostsIDDeleteForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts Id delete forbidden response has a 2xx status code +func (o *V1HostsIDDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts Id delete forbidden response has a 3xx status code +func (o *V1HostsIDDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id delete forbidden response has a 4xx status code +func (o *V1HostsIDDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hosts Id delete forbidden response has a 5xx status code +func (o *V1HostsIDDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts Id delete forbidden response a status code equal to that given +func (o *V1HostsIDDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 hosts Id delete forbidden response +func (o *V1HostsIDDeleteForbidden) Code() int { + return 403 +} + +func (o *V1HostsIDDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /v1/hosts/{host_id}][%d] v1HostsIdDeleteForbidden %+v", 403, o.Payload) +} + +func (o *V1HostsIDDeleteForbidden) String() string { + return fmt.Sprintf("[DELETE /v1/hosts/{host_id}][%d] v1HostsIdDeleteForbidden %+v", 403, o.Payload) +} + +func (o *V1HostsIDDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsIDDeleteForbidden) 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 +} + +// NewV1HostsIDDeleteNotFound creates a V1HostsIDDeleteNotFound with default headers values +func NewV1HostsIDDeleteNotFound() *V1HostsIDDeleteNotFound { + return &V1HostsIDDeleteNotFound{} +} + +/* +V1HostsIDDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1HostsIDDeleteNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts Id delete not found response has a 2xx status code +func (o *V1HostsIDDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts Id delete not found response has a 3xx status code +func (o *V1HostsIDDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id delete not found response has a 4xx status code +func (o *V1HostsIDDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hosts Id delete not found response has a 5xx status code +func (o *V1HostsIDDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts Id delete not found response a status code equal to that given +func (o *V1HostsIDDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 hosts Id delete not found response +func (o *V1HostsIDDeleteNotFound) Code() int { + return 404 +} + +func (o *V1HostsIDDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /v1/hosts/{host_id}][%d] v1HostsIdDeleteNotFound %+v", 404, o.Payload) +} + +func (o *V1HostsIDDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /v1/hosts/{host_id}][%d] v1HostsIdDeleteNotFound %+v", 404, o.Payload) +} + +func (o *V1HostsIDDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsIDDeleteNotFound) 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 +} + +// NewV1HostsIDDeleteInternalServerError creates a V1HostsIDDeleteInternalServerError with default headers values +func NewV1HostsIDDeleteInternalServerError() *V1HostsIDDeleteInternalServerError { + return &V1HostsIDDeleteInternalServerError{} +} + +/* +V1HostsIDDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1HostsIDDeleteInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts Id delete internal server error response has a 2xx status code +func (o *V1HostsIDDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts Id delete internal server error response has a 3xx status code +func (o *V1HostsIDDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id delete internal server error response has a 4xx status code +func (o *V1HostsIDDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hosts Id delete internal server error response has a 5xx status code +func (o *V1HostsIDDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 hosts Id delete internal server error response a status code equal to that given +func (o *V1HostsIDDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 hosts Id delete internal server error response +func (o *V1HostsIDDeleteInternalServerError) Code() int { + return 500 +} + +func (o *V1HostsIDDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /v1/hosts/{host_id}][%d] v1HostsIdDeleteInternalServerError %+v", 500, o.Payload) +} + +func (o *V1HostsIDDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /v1/hosts/{host_id}][%d] v1HostsIdDeleteInternalServerError %+v", 500, o.Payload) +} + +func (o *V1HostsIDDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsIDDeleteInternalServerError) 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 +} + +// NewV1HostsIDDeleteGatewayTimeout creates a V1HostsIDDeleteGatewayTimeout with default headers values +func NewV1HostsIDDeleteGatewayTimeout() *V1HostsIDDeleteGatewayTimeout { + return &V1HostsIDDeleteGatewayTimeout{} +} + +/* +V1HostsIDDeleteGatewayTimeout describes a response with status code 504, with default header values. + +Gateway Timeout. Request is still processing and taking longer than expected. +*/ +type V1HostsIDDeleteGatewayTimeout struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts Id delete gateway timeout response has a 2xx status code +func (o *V1HostsIDDeleteGatewayTimeout) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts Id delete gateway timeout response has a 3xx status code +func (o *V1HostsIDDeleteGatewayTimeout) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id delete gateway timeout response has a 4xx status code +func (o *V1HostsIDDeleteGatewayTimeout) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hosts Id delete gateway timeout response has a 5xx status code +func (o *V1HostsIDDeleteGatewayTimeout) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 hosts Id delete gateway timeout response a status code equal to that given +func (o *V1HostsIDDeleteGatewayTimeout) IsCode(code int) bool { + return code == 504 +} + +// Code gets the status code for the v1 hosts Id delete gateway timeout response +func (o *V1HostsIDDeleteGatewayTimeout) Code() int { + return 504 +} + +func (o *V1HostsIDDeleteGatewayTimeout) Error() string { + return fmt.Sprintf("[DELETE /v1/hosts/{host_id}][%d] v1HostsIdDeleteGatewayTimeout %+v", 504, o.Payload) +} + +func (o *V1HostsIDDeleteGatewayTimeout) String() string { + return fmt.Sprintf("[DELETE /v1/hosts/{host_id}][%d] v1HostsIdDeleteGatewayTimeout %+v", 504, o.Payload) +} + +func (o *V1HostsIDDeleteGatewayTimeout) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsIDDeleteGatewayTimeout) 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/hostgroups/v1_hosts_id_get_parameters.go b/power/client/hostgroups/v1_hosts_id_get_parameters.go new file mode 100644 index 00000000..73c5b368 --- /dev/null +++ b/power/client/hostgroups/v1_hosts_id_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hostgroups + +// 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" +) + +// NewV1HostsIDGetParams creates a new V1HostsIDGetParams 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 NewV1HostsIDGetParams() *V1HostsIDGetParams { + return &V1HostsIDGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1HostsIDGetParamsWithTimeout creates a new V1HostsIDGetParams object +// with the ability to set a timeout on a request. +func NewV1HostsIDGetParamsWithTimeout(timeout time.Duration) *V1HostsIDGetParams { + return &V1HostsIDGetParams{ + timeout: timeout, + } +} + +// NewV1HostsIDGetParamsWithContext creates a new V1HostsIDGetParams object +// with the ability to set a context for a request. +func NewV1HostsIDGetParamsWithContext(ctx context.Context) *V1HostsIDGetParams { + return &V1HostsIDGetParams{ + Context: ctx, + } +} + +// NewV1HostsIDGetParamsWithHTTPClient creates a new V1HostsIDGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1HostsIDGetParamsWithHTTPClient(client *http.Client) *V1HostsIDGetParams { + return &V1HostsIDGetParams{ + HTTPClient: client, + } +} + +/* +V1HostsIDGetParams contains all the parameters to send to the API endpoint + + for the v1 hosts id get operation. + + Typically these are written to a http.Request. +*/ +type V1HostsIDGetParams struct { + + /* HostID. + + Host ID + */ + HostID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 hosts id get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1HostsIDGetParams) WithDefaults() *V1HostsIDGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 hosts id get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1HostsIDGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 hosts id get params +func (o *V1HostsIDGetParams) WithTimeout(timeout time.Duration) *V1HostsIDGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 hosts id get params +func (o *V1HostsIDGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 hosts id get params +func (o *V1HostsIDGetParams) WithContext(ctx context.Context) *V1HostsIDGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 hosts id get params +func (o *V1HostsIDGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 hosts id get params +func (o *V1HostsIDGetParams) WithHTTPClient(client *http.Client) *V1HostsIDGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 hosts id get params +func (o *V1HostsIDGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithHostID adds the hostID to the v1 hosts id get params +func (o *V1HostsIDGetParams) WithHostID(hostID string) *V1HostsIDGetParams { + o.SetHostID(hostID) + return o +} + +// SetHostID adds the hostId to the v1 hosts id get params +func (o *V1HostsIDGetParams) SetHostID(hostID string) { + o.HostID = hostID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1HostsIDGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param host_id + if err := r.SetPathParam("host_id", o.HostID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/hostgroups/v1_hosts_id_get_responses.go b/power/client/hostgroups/v1_hosts_id_get_responses.go new file mode 100644 index 00000000..f28f8270 --- /dev/null +++ b/power/client/hostgroups/v1_hosts_id_get_responses.go @@ -0,0 +1,547 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hostgroups + +// 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" +) + +// V1HostsIDGetReader is a Reader for the V1HostsIDGet structure. +type V1HostsIDGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1HostsIDGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1HostsIDGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1HostsIDGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1HostsIDGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1HostsIDGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1HostsIDGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1HostsIDGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 504: + result := NewV1HostsIDGetGatewayTimeout() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/hosts/{host_id}] v1.hosts.id.get", response, response.Code()) + } +} + +// NewV1HostsIDGetOK creates a V1HostsIDGetOK with default headers values +func NewV1HostsIDGetOK() *V1HostsIDGetOK { + return &V1HostsIDGetOK{} +} + +/* +V1HostsIDGetOK describes a response with status code 200, with default header values. + +OK +*/ +type V1HostsIDGetOK struct { + Payload *models.Host +} + +// IsSuccess returns true when this v1 hosts Id get o k response has a 2xx status code +func (o *V1HostsIDGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 hosts Id get o k response has a 3xx status code +func (o *V1HostsIDGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id get o k response has a 4xx status code +func (o *V1HostsIDGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hosts Id get o k response has a 5xx status code +func (o *V1HostsIDGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts Id get o k response a status code equal to that given +func (o *V1HostsIDGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 hosts Id get o k response +func (o *V1HostsIDGetOK) Code() int { + return 200 +} + +func (o *V1HostsIDGetOK) Error() string { + return fmt.Sprintf("[GET /v1/hosts/{host_id}][%d] v1HostsIdGetOK %+v", 200, o.Payload) +} + +func (o *V1HostsIDGetOK) String() string { + return fmt.Sprintf("[GET /v1/hosts/{host_id}][%d] v1HostsIdGetOK %+v", 200, o.Payload) +} + +func (o *V1HostsIDGetOK) GetPayload() *models.Host { + return o.Payload +} + +func (o *V1HostsIDGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Host) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1HostsIDGetBadRequest creates a V1HostsIDGetBadRequest with default headers values +func NewV1HostsIDGetBadRequest() *V1HostsIDGetBadRequest { + return &V1HostsIDGetBadRequest{} +} + +/* +V1HostsIDGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1HostsIDGetBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts Id get bad request response has a 2xx status code +func (o *V1HostsIDGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts Id get bad request response has a 3xx status code +func (o *V1HostsIDGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id get bad request response has a 4xx status code +func (o *V1HostsIDGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hosts Id get bad request response has a 5xx status code +func (o *V1HostsIDGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts Id get bad request response a status code equal to that given +func (o *V1HostsIDGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 hosts Id get bad request response +func (o *V1HostsIDGetBadRequest) Code() int { + return 400 +} + +func (o *V1HostsIDGetBadRequest) Error() string { + return fmt.Sprintf("[GET /v1/hosts/{host_id}][%d] v1HostsIdGetBadRequest %+v", 400, o.Payload) +} + +func (o *V1HostsIDGetBadRequest) String() string { + return fmt.Sprintf("[GET /v1/hosts/{host_id}][%d] v1HostsIdGetBadRequest %+v", 400, o.Payload) +} + +func (o *V1HostsIDGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsIDGetBadRequest) 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 +} + +// NewV1HostsIDGetUnauthorized creates a V1HostsIDGetUnauthorized with default headers values +func NewV1HostsIDGetUnauthorized() *V1HostsIDGetUnauthorized { + return &V1HostsIDGetUnauthorized{} +} + +/* +V1HostsIDGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1HostsIDGetUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts Id get unauthorized response has a 2xx status code +func (o *V1HostsIDGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts Id get unauthorized response has a 3xx status code +func (o *V1HostsIDGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id get unauthorized response has a 4xx status code +func (o *V1HostsIDGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hosts Id get unauthorized response has a 5xx status code +func (o *V1HostsIDGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts Id get unauthorized response a status code equal to that given +func (o *V1HostsIDGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 hosts Id get unauthorized response +func (o *V1HostsIDGetUnauthorized) Code() int { + return 401 +} + +func (o *V1HostsIDGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /v1/hosts/{host_id}][%d] v1HostsIdGetUnauthorized %+v", 401, o.Payload) +} + +func (o *V1HostsIDGetUnauthorized) String() string { + return fmt.Sprintf("[GET /v1/hosts/{host_id}][%d] v1HostsIdGetUnauthorized %+v", 401, o.Payload) +} + +func (o *V1HostsIDGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsIDGetUnauthorized) 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 +} + +// NewV1HostsIDGetForbidden creates a V1HostsIDGetForbidden with default headers values +func NewV1HostsIDGetForbidden() *V1HostsIDGetForbidden { + return &V1HostsIDGetForbidden{} +} + +/* +V1HostsIDGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1HostsIDGetForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts Id get forbidden response has a 2xx status code +func (o *V1HostsIDGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts Id get forbidden response has a 3xx status code +func (o *V1HostsIDGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id get forbidden response has a 4xx status code +func (o *V1HostsIDGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hosts Id get forbidden response has a 5xx status code +func (o *V1HostsIDGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts Id get forbidden response a status code equal to that given +func (o *V1HostsIDGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 hosts Id get forbidden response +func (o *V1HostsIDGetForbidden) Code() int { + return 403 +} + +func (o *V1HostsIDGetForbidden) Error() string { + return fmt.Sprintf("[GET /v1/hosts/{host_id}][%d] v1HostsIdGetForbidden %+v", 403, o.Payload) +} + +func (o *V1HostsIDGetForbidden) String() string { + return fmt.Sprintf("[GET /v1/hosts/{host_id}][%d] v1HostsIdGetForbidden %+v", 403, o.Payload) +} + +func (o *V1HostsIDGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsIDGetForbidden) 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 +} + +// NewV1HostsIDGetNotFound creates a V1HostsIDGetNotFound with default headers values +func NewV1HostsIDGetNotFound() *V1HostsIDGetNotFound { + return &V1HostsIDGetNotFound{} +} + +/* +V1HostsIDGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1HostsIDGetNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts Id get not found response has a 2xx status code +func (o *V1HostsIDGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts Id get not found response has a 3xx status code +func (o *V1HostsIDGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id get not found response has a 4xx status code +func (o *V1HostsIDGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hosts Id get not found response has a 5xx status code +func (o *V1HostsIDGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts Id get not found response a status code equal to that given +func (o *V1HostsIDGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 hosts Id get not found response +func (o *V1HostsIDGetNotFound) Code() int { + return 404 +} + +func (o *V1HostsIDGetNotFound) Error() string { + return fmt.Sprintf("[GET /v1/hosts/{host_id}][%d] v1HostsIdGetNotFound %+v", 404, o.Payload) +} + +func (o *V1HostsIDGetNotFound) String() string { + return fmt.Sprintf("[GET /v1/hosts/{host_id}][%d] v1HostsIdGetNotFound %+v", 404, o.Payload) +} + +func (o *V1HostsIDGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsIDGetNotFound) 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 +} + +// NewV1HostsIDGetInternalServerError creates a V1HostsIDGetInternalServerError with default headers values +func NewV1HostsIDGetInternalServerError() *V1HostsIDGetInternalServerError { + return &V1HostsIDGetInternalServerError{} +} + +/* +V1HostsIDGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1HostsIDGetInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts Id get internal server error response has a 2xx status code +func (o *V1HostsIDGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts Id get internal server error response has a 3xx status code +func (o *V1HostsIDGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id get internal server error response has a 4xx status code +func (o *V1HostsIDGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hosts Id get internal server error response has a 5xx status code +func (o *V1HostsIDGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 hosts Id get internal server error response a status code equal to that given +func (o *V1HostsIDGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 hosts Id get internal server error response +func (o *V1HostsIDGetInternalServerError) Code() int { + return 500 +} + +func (o *V1HostsIDGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /v1/hosts/{host_id}][%d] v1HostsIdGetInternalServerError %+v", 500, o.Payload) +} + +func (o *V1HostsIDGetInternalServerError) String() string { + return fmt.Sprintf("[GET /v1/hosts/{host_id}][%d] v1HostsIdGetInternalServerError %+v", 500, o.Payload) +} + +func (o *V1HostsIDGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsIDGetInternalServerError) 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 +} + +// NewV1HostsIDGetGatewayTimeout creates a V1HostsIDGetGatewayTimeout with default headers values +func NewV1HostsIDGetGatewayTimeout() *V1HostsIDGetGatewayTimeout { + return &V1HostsIDGetGatewayTimeout{} +} + +/* +V1HostsIDGetGatewayTimeout describes a response with status code 504, with default header values. + +Gateway Timeout. Request is still processing and taking longer than expected. +*/ +type V1HostsIDGetGatewayTimeout struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts Id get gateway timeout response has a 2xx status code +func (o *V1HostsIDGetGatewayTimeout) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts Id get gateway timeout response has a 3xx status code +func (o *V1HostsIDGetGatewayTimeout) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id get gateway timeout response has a 4xx status code +func (o *V1HostsIDGetGatewayTimeout) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hosts Id get gateway timeout response has a 5xx status code +func (o *V1HostsIDGetGatewayTimeout) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 hosts Id get gateway timeout response a status code equal to that given +func (o *V1HostsIDGetGatewayTimeout) IsCode(code int) bool { + return code == 504 +} + +// Code gets the status code for the v1 hosts Id get gateway timeout response +func (o *V1HostsIDGetGatewayTimeout) Code() int { + return 504 +} + +func (o *V1HostsIDGetGatewayTimeout) Error() string { + return fmt.Sprintf("[GET /v1/hosts/{host_id}][%d] v1HostsIdGetGatewayTimeout %+v", 504, o.Payload) +} + +func (o *V1HostsIDGetGatewayTimeout) String() string { + return fmt.Sprintf("[GET /v1/hosts/{host_id}][%d] v1HostsIdGetGatewayTimeout %+v", 504, o.Payload) +} + +func (o *V1HostsIDGetGatewayTimeout) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsIDGetGatewayTimeout) 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/hostgroups/v1_hosts_id_put_parameters.go b/power/client/hostgroups/v1_hosts_id_put_parameters.go new file mode 100644 index 00000000..d1186ae9 --- /dev/null +++ b/power/client/hostgroups/v1_hosts_id_put_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hostgroups + +// 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" +) + +// NewV1HostsIDPutParams creates a new V1HostsIDPutParams 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 NewV1HostsIDPutParams() *V1HostsIDPutParams { + return &V1HostsIDPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1HostsIDPutParamsWithTimeout creates a new V1HostsIDPutParams object +// with the ability to set a timeout on a request. +func NewV1HostsIDPutParamsWithTimeout(timeout time.Duration) *V1HostsIDPutParams { + return &V1HostsIDPutParams{ + timeout: timeout, + } +} + +// NewV1HostsIDPutParamsWithContext creates a new V1HostsIDPutParams object +// with the ability to set a context for a request. +func NewV1HostsIDPutParamsWithContext(ctx context.Context) *V1HostsIDPutParams { + return &V1HostsIDPutParams{ + Context: ctx, + } +} + +// NewV1HostsIDPutParamsWithHTTPClient creates a new V1HostsIDPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1HostsIDPutParamsWithHTTPClient(client *http.Client) *V1HostsIDPutParams { + return &V1HostsIDPutParams{ + HTTPClient: client, + } +} + +/* +V1HostsIDPutParams contains all the parameters to send to the API endpoint + + for the v1 hosts id put operation. + + Typically these are written to a http.Request. +*/ +type V1HostsIDPutParams struct { + + /* Body. + + Parameters to modify a host + */ + Body *models.HostPut + + /* HostID. + + Host ID + */ + HostID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 hosts id put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1HostsIDPutParams) WithDefaults() *V1HostsIDPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 hosts id put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1HostsIDPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 hosts id put params +func (o *V1HostsIDPutParams) WithTimeout(timeout time.Duration) *V1HostsIDPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 hosts id put params +func (o *V1HostsIDPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 hosts id put params +func (o *V1HostsIDPutParams) WithContext(ctx context.Context) *V1HostsIDPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 hosts id put params +func (o *V1HostsIDPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 hosts id put params +func (o *V1HostsIDPutParams) WithHTTPClient(client *http.Client) *V1HostsIDPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 hosts id put params +func (o *V1HostsIDPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 hosts id put params +func (o *V1HostsIDPutParams) WithBody(body *models.HostPut) *V1HostsIDPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 hosts id put params +func (o *V1HostsIDPutParams) SetBody(body *models.HostPut) { + o.Body = body +} + +// WithHostID adds the hostID to the v1 hosts id put params +func (o *V1HostsIDPutParams) WithHostID(hostID string) *V1HostsIDPutParams { + o.SetHostID(hostID) + return o +} + +// SetHostID adds the hostId to the v1 hosts id put params +func (o *V1HostsIDPutParams) SetHostID(hostID string) { + o.HostID = hostID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1HostsIDPutParams) 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 host_id + if err := r.SetPathParam("host_id", o.HostID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/hostgroups/v1_hosts_id_put_responses.go b/power/client/hostgroups/v1_hosts_id_put_responses.go new file mode 100644 index 00000000..322ce86b --- /dev/null +++ b/power/client/hostgroups/v1_hosts_id_put_responses.go @@ -0,0 +1,621 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hostgroups + +// 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" +) + +// V1HostsIDPutReader is a Reader for the V1HostsIDPut structure. +type V1HostsIDPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1HostsIDPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1HostsIDPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1HostsIDPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1HostsIDPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1HostsIDPutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1HostsIDPutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewV1HostsIDPutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1HostsIDPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 504: + result := NewV1HostsIDPutGatewayTimeout() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /v1/hosts/{host_id}] v1.hosts.id.put", response, response.Code()) + } +} + +// NewV1HostsIDPutOK creates a V1HostsIDPutOK with default headers values +func NewV1HostsIDPutOK() *V1HostsIDPutOK { + return &V1HostsIDPutOK{} +} + +/* +V1HostsIDPutOK describes a response with status code 200, with default header values. + +OK +*/ +type V1HostsIDPutOK struct { + Payload *models.Host +} + +// IsSuccess returns true when this v1 hosts Id put o k response has a 2xx status code +func (o *V1HostsIDPutOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 hosts Id put o k response has a 3xx status code +func (o *V1HostsIDPutOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id put o k response has a 4xx status code +func (o *V1HostsIDPutOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hosts Id put o k response has a 5xx status code +func (o *V1HostsIDPutOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts Id put o k response a status code equal to that given +func (o *V1HostsIDPutOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 hosts Id put o k response +func (o *V1HostsIDPutOK) Code() int { + return 200 +} + +func (o *V1HostsIDPutOK) Error() string { + return fmt.Sprintf("[PUT /v1/hosts/{host_id}][%d] v1HostsIdPutOK %+v", 200, o.Payload) +} + +func (o *V1HostsIDPutOK) String() string { + return fmt.Sprintf("[PUT /v1/hosts/{host_id}][%d] v1HostsIdPutOK %+v", 200, o.Payload) +} + +func (o *V1HostsIDPutOK) GetPayload() *models.Host { + return o.Payload +} + +func (o *V1HostsIDPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Host) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1HostsIDPutBadRequest creates a V1HostsIDPutBadRequest with default headers values +func NewV1HostsIDPutBadRequest() *V1HostsIDPutBadRequest { + return &V1HostsIDPutBadRequest{} +} + +/* +V1HostsIDPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1HostsIDPutBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts Id put bad request response has a 2xx status code +func (o *V1HostsIDPutBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts Id put bad request response has a 3xx status code +func (o *V1HostsIDPutBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id put bad request response has a 4xx status code +func (o *V1HostsIDPutBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hosts Id put bad request response has a 5xx status code +func (o *V1HostsIDPutBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts Id put bad request response a status code equal to that given +func (o *V1HostsIDPutBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 hosts Id put bad request response +func (o *V1HostsIDPutBadRequest) Code() int { + return 400 +} + +func (o *V1HostsIDPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /v1/hosts/{host_id}][%d] v1HostsIdPutBadRequest %+v", 400, o.Payload) +} + +func (o *V1HostsIDPutBadRequest) String() string { + return fmt.Sprintf("[PUT /v1/hosts/{host_id}][%d] v1HostsIdPutBadRequest %+v", 400, o.Payload) +} + +func (o *V1HostsIDPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsIDPutBadRequest) 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 +} + +// NewV1HostsIDPutUnauthorized creates a V1HostsIDPutUnauthorized with default headers values +func NewV1HostsIDPutUnauthorized() *V1HostsIDPutUnauthorized { + return &V1HostsIDPutUnauthorized{} +} + +/* +V1HostsIDPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1HostsIDPutUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts Id put unauthorized response has a 2xx status code +func (o *V1HostsIDPutUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts Id put unauthorized response has a 3xx status code +func (o *V1HostsIDPutUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id put unauthorized response has a 4xx status code +func (o *V1HostsIDPutUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hosts Id put unauthorized response has a 5xx status code +func (o *V1HostsIDPutUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts Id put unauthorized response a status code equal to that given +func (o *V1HostsIDPutUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 hosts Id put unauthorized response +func (o *V1HostsIDPutUnauthorized) Code() int { + return 401 +} + +func (o *V1HostsIDPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /v1/hosts/{host_id}][%d] v1HostsIdPutUnauthorized %+v", 401, o.Payload) +} + +func (o *V1HostsIDPutUnauthorized) String() string { + return fmt.Sprintf("[PUT /v1/hosts/{host_id}][%d] v1HostsIdPutUnauthorized %+v", 401, o.Payload) +} + +func (o *V1HostsIDPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsIDPutUnauthorized) 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 +} + +// NewV1HostsIDPutForbidden creates a V1HostsIDPutForbidden with default headers values +func NewV1HostsIDPutForbidden() *V1HostsIDPutForbidden { + return &V1HostsIDPutForbidden{} +} + +/* +V1HostsIDPutForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1HostsIDPutForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts Id put forbidden response has a 2xx status code +func (o *V1HostsIDPutForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts Id put forbidden response has a 3xx status code +func (o *V1HostsIDPutForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id put forbidden response has a 4xx status code +func (o *V1HostsIDPutForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hosts Id put forbidden response has a 5xx status code +func (o *V1HostsIDPutForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts Id put forbidden response a status code equal to that given +func (o *V1HostsIDPutForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 hosts Id put forbidden response +func (o *V1HostsIDPutForbidden) Code() int { + return 403 +} + +func (o *V1HostsIDPutForbidden) Error() string { + return fmt.Sprintf("[PUT /v1/hosts/{host_id}][%d] v1HostsIdPutForbidden %+v", 403, o.Payload) +} + +func (o *V1HostsIDPutForbidden) String() string { + return fmt.Sprintf("[PUT /v1/hosts/{host_id}][%d] v1HostsIdPutForbidden %+v", 403, o.Payload) +} + +func (o *V1HostsIDPutForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsIDPutForbidden) 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 +} + +// NewV1HostsIDPutNotFound creates a V1HostsIDPutNotFound with default headers values +func NewV1HostsIDPutNotFound() *V1HostsIDPutNotFound { + return &V1HostsIDPutNotFound{} +} + +/* +V1HostsIDPutNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1HostsIDPutNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts Id put not found response has a 2xx status code +func (o *V1HostsIDPutNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts Id put not found response has a 3xx status code +func (o *V1HostsIDPutNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id put not found response has a 4xx status code +func (o *V1HostsIDPutNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hosts Id put not found response has a 5xx status code +func (o *V1HostsIDPutNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts Id put not found response a status code equal to that given +func (o *V1HostsIDPutNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 hosts Id put not found response +func (o *V1HostsIDPutNotFound) Code() int { + return 404 +} + +func (o *V1HostsIDPutNotFound) Error() string { + return fmt.Sprintf("[PUT /v1/hosts/{host_id}][%d] v1HostsIdPutNotFound %+v", 404, o.Payload) +} + +func (o *V1HostsIDPutNotFound) String() string { + return fmt.Sprintf("[PUT /v1/hosts/{host_id}][%d] v1HostsIdPutNotFound %+v", 404, o.Payload) +} + +func (o *V1HostsIDPutNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsIDPutNotFound) 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 +} + +// NewV1HostsIDPutUnprocessableEntity creates a V1HostsIDPutUnprocessableEntity with default headers values +func NewV1HostsIDPutUnprocessableEntity() *V1HostsIDPutUnprocessableEntity { + return &V1HostsIDPutUnprocessableEntity{} +} + +/* +V1HostsIDPutUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type V1HostsIDPutUnprocessableEntity struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts Id put unprocessable entity response has a 2xx status code +func (o *V1HostsIDPutUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts Id put unprocessable entity response has a 3xx status code +func (o *V1HostsIDPutUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id put unprocessable entity response has a 4xx status code +func (o *V1HostsIDPutUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hosts Id put unprocessable entity response has a 5xx status code +func (o *V1HostsIDPutUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts Id put unprocessable entity response a status code equal to that given +func (o *V1HostsIDPutUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the v1 hosts Id put unprocessable entity response +func (o *V1HostsIDPutUnprocessableEntity) Code() int { + return 422 +} + +func (o *V1HostsIDPutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /v1/hosts/{host_id}][%d] v1HostsIdPutUnprocessableEntity %+v", 422, o.Payload) +} + +func (o *V1HostsIDPutUnprocessableEntity) String() string { + return fmt.Sprintf("[PUT /v1/hosts/{host_id}][%d] v1HostsIdPutUnprocessableEntity %+v", 422, o.Payload) +} + +func (o *V1HostsIDPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsIDPutUnprocessableEntity) 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 +} + +// NewV1HostsIDPutInternalServerError creates a V1HostsIDPutInternalServerError with default headers values +func NewV1HostsIDPutInternalServerError() *V1HostsIDPutInternalServerError { + return &V1HostsIDPutInternalServerError{} +} + +/* +V1HostsIDPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1HostsIDPutInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts Id put internal server error response has a 2xx status code +func (o *V1HostsIDPutInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts Id put internal server error response has a 3xx status code +func (o *V1HostsIDPutInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id put internal server error response has a 4xx status code +func (o *V1HostsIDPutInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hosts Id put internal server error response has a 5xx status code +func (o *V1HostsIDPutInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 hosts Id put internal server error response a status code equal to that given +func (o *V1HostsIDPutInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 hosts Id put internal server error response +func (o *V1HostsIDPutInternalServerError) Code() int { + return 500 +} + +func (o *V1HostsIDPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /v1/hosts/{host_id}][%d] v1HostsIdPutInternalServerError %+v", 500, o.Payload) +} + +func (o *V1HostsIDPutInternalServerError) String() string { + return fmt.Sprintf("[PUT /v1/hosts/{host_id}][%d] v1HostsIdPutInternalServerError %+v", 500, o.Payload) +} + +func (o *V1HostsIDPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsIDPutInternalServerError) 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 +} + +// NewV1HostsIDPutGatewayTimeout creates a V1HostsIDPutGatewayTimeout with default headers values +func NewV1HostsIDPutGatewayTimeout() *V1HostsIDPutGatewayTimeout { + return &V1HostsIDPutGatewayTimeout{} +} + +/* +V1HostsIDPutGatewayTimeout describes a response with status code 504, with default header values. + +Gateway Timeout. Request is still processing and taking longer than expected. +*/ +type V1HostsIDPutGatewayTimeout struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts Id put gateway timeout response has a 2xx status code +func (o *V1HostsIDPutGatewayTimeout) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts Id put gateway timeout response has a 3xx status code +func (o *V1HostsIDPutGatewayTimeout) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts Id put gateway timeout response has a 4xx status code +func (o *V1HostsIDPutGatewayTimeout) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hosts Id put gateway timeout response has a 5xx status code +func (o *V1HostsIDPutGatewayTimeout) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 hosts Id put gateway timeout response a status code equal to that given +func (o *V1HostsIDPutGatewayTimeout) IsCode(code int) bool { + return code == 504 +} + +// Code gets the status code for the v1 hosts Id put gateway timeout response +func (o *V1HostsIDPutGatewayTimeout) Code() int { + return 504 +} + +func (o *V1HostsIDPutGatewayTimeout) Error() string { + return fmt.Sprintf("[PUT /v1/hosts/{host_id}][%d] v1HostsIdPutGatewayTimeout %+v", 504, o.Payload) +} + +func (o *V1HostsIDPutGatewayTimeout) String() string { + return fmt.Sprintf("[PUT /v1/hosts/{host_id}][%d] v1HostsIdPutGatewayTimeout %+v", 504, o.Payload) +} + +func (o *V1HostsIDPutGatewayTimeout) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsIDPutGatewayTimeout) 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/hostgroups/v1_hosts_post_parameters.go b/power/client/hostgroups/v1_hosts_post_parameters.go new file mode 100644 index 00000000..d44a5ff3 --- /dev/null +++ b/power/client/hostgroups/v1_hosts_post_parameters.go @@ -0,0 +1,153 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hostgroups + +// 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" +) + +// NewV1HostsPostParams creates a new V1HostsPostParams 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 NewV1HostsPostParams() *V1HostsPostParams { + return &V1HostsPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1HostsPostParamsWithTimeout creates a new V1HostsPostParams object +// with the ability to set a timeout on a request. +func NewV1HostsPostParamsWithTimeout(timeout time.Duration) *V1HostsPostParams { + return &V1HostsPostParams{ + timeout: timeout, + } +} + +// NewV1HostsPostParamsWithContext creates a new V1HostsPostParams object +// with the ability to set a context for a request. +func NewV1HostsPostParamsWithContext(ctx context.Context) *V1HostsPostParams { + return &V1HostsPostParams{ + Context: ctx, + } +} + +// NewV1HostsPostParamsWithHTTPClient creates a new V1HostsPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1HostsPostParamsWithHTTPClient(client *http.Client) *V1HostsPostParams { + return &V1HostsPostParams{ + HTTPClient: client, + } +} + +/* +V1HostsPostParams contains all the parameters to send to the API endpoint + + for the v1 hosts post operation. + + Typically these are written to a http.Request. +*/ +type V1HostsPostParams struct { + + /* Body. + + Parameters to add a host to an existing hostgroup + */ + Body *models.HostCreate + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 hosts post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1HostsPostParams) WithDefaults() *V1HostsPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 hosts post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1HostsPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 hosts post params +func (o *V1HostsPostParams) WithTimeout(timeout time.Duration) *V1HostsPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 hosts post params +func (o *V1HostsPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 hosts post params +func (o *V1HostsPostParams) WithContext(ctx context.Context) *V1HostsPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 hosts post params +func (o *V1HostsPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 hosts post params +func (o *V1HostsPostParams) WithHTTPClient(client *http.Client) *V1HostsPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 hosts post params +func (o *V1HostsPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 hosts post params +func (o *V1HostsPostParams) WithBody(body *models.HostCreate) *V1HostsPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 hosts post params +func (o *V1HostsPostParams) SetBody(body *models.HostCreate) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *V1HostsPostParams) 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 + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/hostgroups/v1_hosts_post_responses.go b/power/client/hostgroups/v1_hosts_post_responses.go new file mode 100644 index 00000000..40dc82e7 --- /dev/null +++ b/power/client/hostgroups/v1_hosts_post_responses.go @@ -0,0 +1,547 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hostgroups + +// 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" +) + +// V1HostsPostReader is a Reader for the V1HostsPost structure. +type V1HostsPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1HostsPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 201: + result := NewV1HostsPostCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1HostsPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1HostsPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1HostsPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewV1HostsPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1HostsPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 504: + result := NewV1HostsPostGatewayTimeout() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /v1/hosts] v1.hosts.post", response, response.Code()) + } +} + +// NewV1HostsPostCreated creates a V1HostsPostCreated with default headers values +func NewV1HostsPostCreated() *V1HostsPostCreated { + return &V1HostsPostCreated{} +} + +/* +V1HostsPostCreated describes a response with status code 201, with default header values. + +Created +*/ +type V1HostsPostCreated struct { + Payload *models.Host +} + +// IsSuccess returns true when this v1 hosts post created response has a 2xx status code +func (o *V1HostsPostCreated) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 hosts post created response has a 3xx status code +func (o *V1HostsPostCreated) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts post created response has a 4xx status code +func (o *V1HostsPostCreated) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hosts post created response has a 5xx status code +func (o *V1HostsPostCreated) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts post created response a status code equal to that given +func (o *V1HostsPostCreated) IsCode(code int) bool { + return code == 201 +} + +// Code gets the status code for the v1 hosts post created response +func (o *V1HostsPostCreated) Code() int { + return 201 +} + +func (o *V1HostsPostCreated) Error() string { + return fmt.Sprintf("[POST /v1/hosts][%d] v1HostsPostCreated %+v", 201, o.Payload) +} + +func (o *V1HostsPostCreated) String() string { + return fmt.Sprintf("[POST /v1/hosts][%d] v1HostsPostCreated %+v", 201, o.Payload) +} + +func (o *V1HostsPostCreated) GetPayload() *models.Host { + return o.Payload +} + +func (o *V1HostsPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Host) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1HostsPostBadRequest creates a V1HostsPostBadRequest with default headers values +func NewV1HostsPostBadRequest() *V1HostsPostBadRequest { + return &V1HostsPostBadRequest{} +} + +/* +V1HostsPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1HostsPostBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts post bad request response has a 2xx status code +func (o *V1HostsPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts post bad request response has a 3xx status code +func (o *V1HostsPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts post bad request response has a 4xx status code +func (o *V1HostsPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hosts post bad request response has a 5xx status code +func (o *V1HostsPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts post bad request response a status code equal to that given +func (o *V1HostsPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 hosts post bad request response +func (o *V1HostsPostBadRequest) Code() int { + return 400 +} + +func (o *V1HostsPostBadRequest) Error() string { + return fmt.Sprintf("[POST /v1/hosts][%d] v1HostsPostBadRequest %+v", 400, o.Payload) +} + +func (o *V1HostsPostBadRequest) String() string { + return fmt.Sprintf("[POST /v1/hosts][%d] v1HostsPostBadRequest %+v", 400, o.Payload) +} + +func (o *V1HostsPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsPostBadRequest) 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 +} + +// NewV1HostsPostUnauthorized creates a V1HostsPostUnauthorized with default headers values +func NewV1HostsPostUnauthorized() *V1HostsPostUnauthorized { + return &V1HostsPostUnauthorized{} +} + +/* +V1HostsPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1HostsPostUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts post unauthorized response has a 2xx status code +func (o *V1HostsPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts post unauthorized response has a 3xx status code +func (o *V1HostsPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts post unauthorized response has a 4xx status code +func (o *V1HostsPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hosts post unauthorized response has a 5xx status code +func (o *V1HostsPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts post unauthorized response a status code equal to that given +func (o *V1HostsPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 hosts post unauthorized response +func (o *V1HostsPostUnauthorized) Code() int { + return 401 +} + +func (o *V1HostsPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /v1/hosts][%d] v1HostsPostUnauthorized %+v", 401, o.Payload) +} + +func (o *V1HostsPostUnauthorized) String() string { + return fmt.Sprintf("[POST /v1/hosts][%d] v1HostsPostUnauthorized %+v", 401, o.Payload) +} + +func (o *V1HostsPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsPostUnauthorized) 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 +} + +// NewV1HostsPostForbidden creates a V1HostsPostForbidden with default headers values +func NewV1HostsPostForbidden() *V1HostsPostForbidden { + return &V1HostsPostForbidden{} +} + +/* +V1HostsPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1HostsPostForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts post forbidden response has a 2xx status code +func (o *V1HostsPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts post forbidden response has a 3xx status code +func (o *V1HostsPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts post forbidden response has a 4xx status code +func (o *V1HostsPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hosts post forbidden response has a 5xx status code +func (o *V1HostsPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts post forbidden response a status code equal to that given +func (o *V1HostsPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 hosts post forbidden response +func (o *V1HostsPostForbidden) Code() int { + return 403 +} + +func (o *V1HostsPostForbidden) Error() string { + return fmt.Sprintf("[POST /v1/hosts][%d] v1HostsPostForbidden %+v", 403, o.Payload) +} + +func (o *V1HostsPostForbidden) String() string { + return fmt.Sprintf("[POST /v1/hosts][%d] v1HostsPostForbidden %+v", 403, o.Payload) +} + +func (o *V1HostsPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsPostForbidden) 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 +} + +// NewV1HostsPostUnprocessableEntity creates a V1HostsPostUnprocessableEntity with default headers values +func NewV1HostsPostUnprocessableEntity() *V1HostsPostUnprocessableEntity { + return &V1HostsPostUnprocessableEntity{} +} + +/* +V1HostsPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type V1HostsPostUnprocessableEntity struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts post unprocessable entity response has a 2xx status code +func (o *V1HostsPostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts post unprocessable entity response has a 3xx status code +func (o *V1HostsPostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts post unprocessable entity response has a 4xx status code +func (o *V1HostsPostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 hosts post unprocessable entity response has a 5xx status code +func (o *V1HostsPostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 hosts post unprocessable entity response a status code equal to that given +func (o *V1HostsPostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the v1 hosts post unprocessable entity response +func (o *V1HostsPostUnprocessableEntity) Code() int { + return 422 +} + +func (o *V1HostsPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /v1/hosts][%d] v1HostsPostUnprocessableEntity %+v", 422, o.Payload) +} + +func (o *V1HostsPostUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /v1/hosts][%d] v1HostsPostUnprocessableEntity %+v", 422, o.Payload) +} + +func (o *V1HostsPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsPostUnprocessableEntity) 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 +} + +// NewV1HostsPostInternalServerError creates a V1HostsPostInternalServerError with default headers values +func NewV1HostsPostInternalServerError() *V1HostsPostInternalServerError { + return &V1HostsPostInternalServerError{} +} + +/* +V1HostsPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1HostsPostInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts post internal server error response has a 2xx status code +func (o *V1HostsPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts post internal server error response has a 3xx status code +func (o *V1HostsPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts post internal server error response has a 4xx status code +func (o *V1HostsPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hosts post internal server error response has a 5xx status code +func (o *V1HostsPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 hosts post internal server error response a status code equal to that given +func (o *V1HostsPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 hosts post internal server error response +func (o *V1HostsPostInternalServerError) Code() int { + return 500 +} + +func (o *V1HostsPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /v1/hosts][%d] v1HostsPostInternalServerError %+v", 500, o.Payload) +} + +func (o *V1HostsPostInternalServerError) String() string { + return fmt.Sprintf("[POST /v1/hosts][%d] v1HostsPostInternalServerError %+v", 500, o.Payload) +} + +func (o *V1HostsPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsPostInternalServerError) 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 +} + +// NewV1HostsPostGatewayTimeout creates a V1HostsPostGatewayTimeout with default headers values +func NewV1HostsPostGatewayTimeout() *V1HostsPostGatewayTimeout { + return &V1HostsPostGatewayTimeout{} +} + +/* +V1HostsPostGatewayTimeout describes a response with status code 504, with default header values. + +Gateway Timeout. Request is still processing and taking longer than expected. +*/ +type V1HostsPostGatewayTimeout struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 hosts post gateway timeout response has a 2xx status code +func (o *V1HostsPostGatewayTimeout) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 hosts post gateway timeout response has a 3xx status code +func (o *V1HostsPostGatewayTimeout) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 hosts post gateway timeout response has a 4xx status code +func (o *V1HostsPostGatewayTimeout) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 hosts post gateway timeout response has a 5xx status code +func (o *V1HostsPostGatewayTimeout) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 hosts post gateway timeout response a status code equal to that given +func (o *V1HostsPostGatewayTimeout) IsCode(code int) bool { + return code == 504 +} + +// Code gets the status code for the v1 hosts post gateway timeout response +func (o *V1HostsPostGatewayTimeout) Code() int { + return 504 +} + +func (o *V1HostsPostGatewayTimeout) Error() string { + return fmt.Sprintf("[POST /v1/hosts][%d] v1HostsPostGatewayTimeout %+v", 504, o.Payload) +} + +func (o *V1HostsPostGatewayTimeout) String() string { + return fmt.Sprintf("[POST /v1/hosts][%d] v1HostsPostGatewayTimeout %+v", 504, o.Payload) +} + +func (o *V1HostsPostGatewayTimeout) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1HostsPostGatewayTimeout) 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 a74bb77f..2b8c1a8c 100644 --- a/power/client/power_iaas_api_client.go +++ b/power/client/power_iaas_api_client.go @@ -15,6 +15,7 @@ import ( "github.com/IBM-Cloud/power-go-client/power/client/catalog" "github.com/IBM-Cloud/power-go-client/power/client/datacenters" "github.com/IBM-Cloud/power-go-client/power/client/hardware_platforms" + "github.com/IBM-Cloud/power-go-client/power/client/hostgroups" "github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker" "github.com/IBM-Cloud/power-go-client/power/client/internal_power_v_s_instances" "github.com/IBM-Cloud/power-go-client/power/client/internal_power_v_s_locations" @@ -101,6 +102,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *PowerIaasA cli.Catalog = catalog.New(transport, formats) cli.Datacenters = datacenters.New(transport, formats) cli.HardwarePlatforms = hardware_platforms.New(transport, formats) + cli.Hostgroups = hostgroups.New(transport, formats) cli.IaasServiceBroker = iaas_service_broker.New(transport, formats) cli.InternalPowervsInstances = internal_power_v_s_instances.New(transport, formats) cli.InternalPowervsLocations = internal_power_v_s_locations.New(transport, formats) @@ -192,6 +194,8 @@ type PowerIaasAPI struct { HardwarePlatforms hardware_platforms.ClientService + Hostgroups hostgroups.ClientService + IaasServiceBroker iaas_service_broker.ClientService InternalPowervsInstances internal_power_v_s_instances.ClientService @@ -277,6 +281,7 @@ func (c *PowerIaasAPI) SetTransport(transport runtime.ClientTransport) { c.Catalog.SetTransport(transport) c.Datacenters.SetTransport(transport) c.HardwarePlatforms.SetTransport(transport) + c.Hostgroups.SetTransport(transport) c.IaasServiceBroker.SetTransport(transport) c.InternalPowervsInstances.SetTransport(transport) c.InternalPowervsLocations.SetTransport(transport) diff --git a/power/models/add_host.go b/power/models/add_host.go new file mode 100644 index 00000000..fb06e74e --- /dev/null +++ b/power/models/add_host.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" +) + +// AddHost Host to add to a hostgroup +// +// swagger:model AddHost +type AddHost struct { + + // Name of the host chosen by the user + // Required: true + DisplayName *string `json:"displayName"` + + // System type + // Required: true + SysType *string `json:"sysType"` +} + +// Validate validates this add host +func (m *AddHost) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDisplayName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSysType(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AddHost) validateDisplayName(formats strfmt.Registry) error { + + if err := validate.Required("displayName", "body", m.DisplayName); err != nil { + return err + } + + return nil +} + +func (m *AddHost) validateSysType(formats strfmt.Registry) error { + + if err := validate.Required("sysType", "body", m.SysType); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this add host based on context it is used +func (m *AddHost) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *AddHost) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AddHost) UnmarshalBinary(b []byte) error { + var res AddHost + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/available_host.go b/power/models/available_host.go new file mode 100644 index 00000000..eee4688a --- /dev/null +++ b/power/models/available_host.go @@ -0,0 +1,115 @@ +// 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" +) + +// AvailableHost Reservable host description +// +// swagger:model AvailableHost +type AvailableHost struct { + + // Resource capacities for that system type and configuration + Capacity *HostAvailableCapacity `json:"capacity,omitempty"` + + // How many hosts of such type/capacities are available + Count float64 `json:"count,omitempty"` + + // System type + SysType string `json:"sysType,omitempty"` +} + +// Validate validates this available host +func (m *AvailableHost) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCapacity(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AvailableHost) validateCapacity(formats strfmt.Registry) error { + if swag.IsZero(m.Capacity) { // not required + return nil + } + + if m.Capacity != nil { + if err := m.Capacity.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("capacity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("capacity") + } + return err + } + } + + return nil +} + +// ContextValidate validate this available host based on the context it is used +func (m *AvailableHost) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCapacity(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AvailableHost) contextValidateCapacity(ctx context.Context, formats strfmt.Registry) error { + + if m.Capacity != nil { + + if swag.IsZero(m.Capacity) { // not required + return nil + } + + if err := m.Capacity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("capacity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("capacity") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *AvailableHost) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AvailableHost) UnmarshalBinary(b []byte) error { + var res AvailableHost + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/available_host_list.go b/power/models/available_host_list.go new file mode 100644 index 00000000..17015104 --- /dev/null +++ b/power/models/available_host_list.go @@ -0,0 +1,67 @@ +// 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/validate" +) + +// AvailableHostList available host list +// +// swagger:model AvailableHostList +type AvailableHostList map[string]AvailableHost + +// Validate validates this available host list +func (m AvailableHostList) Validate(formats strfmt.Registry) error { + var res []error + + for k := range m { + + if err := validate.Required(k, "body", m[k]); err != nil { + return err + } + if val, ok := m[k]; ok { + if err := val.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(k) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(k) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this available host list based on the context it is used +func (m AvailableHostList) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for k := range m { + + if val, ok := m[k]; ok { + if err := val.ContextValidate(ctx, formats); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/models/host.go b/power/models/host.go new file mode 100644 index 00000000..3bb9d168 --- /dev/null +++ b/power/models/host.go @@ -0,0 +1,167 @@ +// 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" +) + +// Host Host description +// +// swagger:model Host +type Host struct { + + // Capacities of the host + Capacity *HostCapacity `json:"capacity,omitempty"` + + // Name of the host (chosen by the user) + DisplayName string `json:"displayName,omitempty"` + + // Link to the owning hostgroup + Hostgroup HostgroupHref `json:"hostgroup,omitempty"` + + // ID of the host + ID string `json:"id,omitempty"` + + // State of the host (up/down) + State string `json:"state,omitempty"` + + // Status of the host (enabled/disabled) + Status string `json:"status,omitempty"` +} + +// Validate validates this host +func (m *Host) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCapacity(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHostgroup(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Host) validateCapacity(formats strfmt.Registry) error { + if swag.IsZero(m.Capacity) { // not required + return nil + } + + if m.Capacity != nil { + if err := m.Capacity.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("capacity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("capacity") + } + return err + } + } + + return nil +} + +func (m *Host) validateHostgroup(formats strfmt.Registry) error { + if swag.IsZero(m.Hostgroup) { // not required + return nil + } + + if err := m.Hostgroup.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hostgroup") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("hostgroup") + } + return err + } + + return nil +} + +// ContextValidate validate this host based on the context it is used +func (m *Host) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCapacity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateHostgroup(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Host) contextValidateCapacity(ctx context.Context, formats strfmt.Registry) error { + + if m.Capacity != nil { + + if swag.IsZero(m.Capacity) { // not required + return nil + } + + if err := m.Capacity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("capacity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("capacity") + } + return err + } + } + + return nil +} + +func (m *Host) contextValidateHostgroup(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Hostgroup) { // not required + return nil + } + + if err := m.Hostgroup.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hostgroup") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("hostgroup") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Host) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Host) UnmarshalBinary(b []byte) error { + var res Host + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/host_available_capacity.go b/power/models/host_available_capacity.go new file mode 100644 index 00000000..4099a90f --- /dev/null +++ b/power/models/host_available_capacity.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" +) + +// HostAvailableCapacity host available capacity +// +// swagger:model HostAvailableCapacity +type HostAvailableCapacity struct { + + // Number of cores available on the host + AvailableCore float64 `json:"availableCore,omitempty"` + + // Memory capacity available on the host (in MB) + AvailableMemory float64 `json:"availableMemory,omitempty"` +} + +// Validate validates this host available capacity +func (m *HostAvailableCapacity) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this host available capacity based on context it is used +func (m *HostAvailableCapacity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *HostAvailableCapacity) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HostAvailableCapacity) UnmarshalBinary(b []byte) error { + var res HostAvailableCapacity + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/host_capacity.go b/power/models/host_capacity.go new file mode 100644 index 00000000..1e822fb7 --- /dev/null +++ b/power/models/host_capacity.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/strfmt" + "github.com/go-openapi/swag" +) + +// HostCapacity host capacity +// +// swagger:model HostCapacity +type HostCapacity struct { + + // Number of cores currently available + AvailableCore float64 `json:"availableCore,omitempty"` + + // Amount of memory currently available (in MB) + AvailableMemory float64 `json:"availableMemory,omitempty"` + + // Number of cores reserved for system use + ReservedCore float64 `json:"reservedCore,omitempty"` + + // Amount of memory reserved for system use (in MB) + ReservedMemory float64 `json:"reservedMemory,omitempty"` + + // Total number of cores of the host + TotalCore float64 `json:"totalCore,omitempty"` + + // Total amount of memory of the host (in MB) + TotalMemory float64 `json:"totalMemory,omitempty"` + + // Number of cores in use on the host + UsedCore float64 `json:"usedCore,omitempty"` + + // Amount of memory used on the host (in MB) + UsedMemory float64 `json:"usedMemory,omitempty"` +} + +// Validate validates this host capacity +func (m *HostCapacity) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this host capacity based on context it is used +func (m *HostCapacity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *HostCapacity) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HostCapacity) UnmarshalBinary(b []byte) error { + var res HostCapacity + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/host_create.go b/power/models/host_create.go new file mode 100644 index 00000000..0e7d68ee --- /dev/null +++ b/power/models/host_create.go @@ -0,0 +1,125 @@ +// 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" +) + +// HostCreate Parameters to add a host to an existing hostgroup +// +// swagger:model HostCreate +type HostCreate struct { + + // Host to be added + // Required: true + Host *AddHost `json:"host"` + + // ID of the hostgroup to which the host should be added + // Required: true + HostgroupID *string `json:"hostgroupID"` +} + +// Validate validates this host create +func (m *HostCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateHost(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHostgroupID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostCreate) validateHost(formats strfmt.Registry) error { + + if err := validate.Required("host", "body", m.Host); err != nil { + return err + } + + if m.Host != nil { + if err := m.Host.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("host") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("host") + } + return err + } + } + + return nil +} + +func (m *HostCreate) validateHostgroupID(formats strfmt.Registry) error { + + if err := validate.Required("hostgroupID", "body", m.HostgroupID); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this host create based on the context it is used +func (m *HostCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateHost(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostCreate) contextValidateHost(ctx context.Context, formats strfmt.Registry) error { + + if m.Host != nil { + + if err := m.Host.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("host") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("host") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HostCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HostCreate) UnmarshalBinary(b []byte) error { + var res HostCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/host_href.go b/power/models/host_href.go new file mode 100644 index 00000000..4ac88f4c --- /dev/null +++ b/power/models/host_href.go @@ -0,0 +1,27 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" +) + +// HostHref Link to host resource +// +// swagger:model HostHref +type HostHref string + +// Validate validates this host href +func (m HostHref) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this host href based on context it is used +func (m HostHref) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/power/models/host_list.go b/power/models/host_list.go new file mode 100644 index 00000000..582de3fd --- /dev/null +++ b/power/models/host_list.go @@ -0,0 +1,78 @@ +// 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" +) + +// HostList host list +// +// swagger:model HostList +type HostList []*Host + +// Validate validates this host list +func (m HostList) Validate(formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + if swag.IsZero(m[i]) { // not required + continue + } + + if m[i] != nil { + if err := m[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this host list based on the context it is used +func (m HostList) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + + if m[i] != nil { + + if swag.IsZero(m[i]) { // not required + return nil + } + + if err := m[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/models/host_put.go b/power/models/host_put.go new file mode 100644 index 00000000..ffb48fbb --- /dev/null +++ b/power/models/host_put.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" +) + +// HostPut Parameters to modify a host +// +// swagger:model HostPut +type HostPut struct { + + // Name of the host chosen by the user + // Required: true + DisplayName *string `json:"displayName"` +} + +// Validate validates this host put +func (m *HostPut) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDisplayName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostPut) validateDisplayName(formats strfmt.Registry) error { + + if err := validate.Required("displayName", "body", m.DisplayName); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this host put based on context it is used +func (m *HostPut) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *HostPut) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HostPut) UnmarshalBinary(b []byte) error { + var res HostPut + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/hostgroup.go b/power/models/hostgroup.go new file mode 100644 index 00000000..737d4c8f --- /dev/null +++ b/power/models/hostgroup.go @@ -0,0 +1,143 @@ +// 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" +) + +// Hostgroup Description of a hostgroup +// +// swagger:model Hostgroup +type Hostgroup struct { + + // Date/Time of hostgroup creation + // Format: date-time + CreationDate strfmt.DateTime `json:"creationDate,omitempty"` + + // List of hosts + Hosts []HostHref `json:"hosts"` + + // Hostgroup ID + ID string `json:"id,omitempty"` + + // Name of the hostgroup + Name string `json:"name,omitempty"` + + // Name of the workspace owning the hostgroup + Primary string `json:"primary,omitempty"` +} + +// Validate validates this hostgroup +func (m *Hostgroup) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreationDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHosts(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Hostgroup) validateCreationDate(formats strfmt.Registry) error { + if swag.IsZero(m.CreationDate) { // not required + return nil + } + + if err := validate.FormatOf("creationDate", "body", "date-time", m.CreationDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *Hostgroup) validateHosts(formats strfmt.Registry) error { + if swag.IsZero(m.Hosts) { // not required + return nil + } + + for i := 0; i < len(m.Hosts); i++ { + + if err := m.Hosts[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hosts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("hosts" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +// ContextValidate validate this hostgroup based on the context it is used +func (m *Hostgroup) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateHosts(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Hostgroup) contextValidateHosts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Hosts); i++ { + + if swag.IsZero(m.Hosts[i]) { // not required + return nil + } + + if err := m.Hosts[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hosts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("hosts" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Hostgroup) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Hostgroup) UnmarshalBinary(b []byte) error { + var res Hostgroup + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/hostgroup_create.go b/power/models/hostgroup_create.go new file mode 100644 index 00000000..93ff3bc4 --- /dev/null +++ b/power/models/hostgroup_create.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" +) + +// HostgroupCreate Parameters for the creation of a new hostgroup +// +// swagger:model HostgroupCreate +type HostgroupCreate struct { + + // List of hosts to add to the group + // Required: true + Hosts []*AddHost `json:"hosts"` + + // Name of the hostgroup to create + // Required: true + Name *string `json:"name"` +} + +// Validate validates this hostgroup create +func (m *HostgroupCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateHosts(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostgroupCreate) validateHosts(formats strfmt.Registry) error { + + if err := validate.Required("hosts", "body", m.Hosts); err != nil { + return err + } + + for i := 0; i < len(m.Hosts); i++ { + if swag.IsZero(m.Hosts[i]) { // not required + continue + } + + if m.Hosts[i] != nil { + if err := m.Hosts[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hosts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("hosts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *HostgroupCreate) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this hostgroup create based on the context it is used +func (m *HostgroupCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateHosts(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostgroupCreate) contextValidateHosts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Hosts); i++ { + + if m.Hosts[i] != nil { + + if swag.IsZero(m.Hosts[i]) { // not required + return nil + } + + if err := m.Hosts[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hosts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("hosts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HostgroupCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HostgroupCreate) UnmarshalBinary(b []byte) error { + var res HostgroupCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/hostgroup_href.go b/power/models/hostgroup_href.go new file mode 100644 index 00000000..2733f00f --- /dev/null +++ b/power/models/hostgroup_href.go @@ -0,0 +1,27 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" +) + +// HostgroupHref Link to hostgroup resource +// +// swagger:model HostgroupHref +type HostgroupHref string + +// Validate validates this hostgroup href +func (m HostgroupHref) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this hostgroup href based on context it is used +func (m HostgroupHref) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/power/models/hostgroup_list.go b/power/models/hostgroup_list.go new file mode 100644 index 00000000..bdcc2bb3 --- /dev/null +++ b/power/models/hostgroup_list.go @@ -0,0 +1,78 @@ +// 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" +) + +// HostgroupList hostgroup list +// +// swagger:model HostgroupList +type HostgroupList []*Hostgroup + +// Validate validates this hostgroup list +func (m HostgroupList) Validate(formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + if swag.IsZero(m[i]) { // not required + continue + } + + if m[i] != nil { + if err := m[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this hostgroup list based on the context it is used +func (m HostgroupList) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + + if m[i] != nil { + + if swag.IsZero(m[i]) { // not required + return nil + } + + if err := m[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/models/hostgroup_share_op.go b/power/models/hostgroup_share_op.go new file mode 100644 index 00000000..ebd3fd75 --- /dev/null +++ b/power/models/hostgroup_share_op.go @@ -0,0 +1,124 @@ +// 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" +) + +// HostgroupShareOp Operation updating the sharing status (mutually exclusive) +// +// swagger:model HostgroupShareOp +type HostgroupShareOp struct { + + // List of workspace names to share the hostgroup with + Add []*Secondary `json:"add"` + + // A workspace name to stop sharing the hostgroup with + Remove string `json:"remove,omitempty"` +} + +// Validate validates this hostgroup share op +func (m *HostgroupShareOp) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAdd(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostgroupShareOp) validateAdd(formats strfmt.Registry) error { + if swag.IsZero(m.Add) { // not required + return nil + } + + for i := 0; i < len(m.Add); i++ { + if swag.IsZero(m.Add[i]) { // not required + continue + } + + if m.Add[i] != nil { + if err := m.Add[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("add" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("add" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this hostgroup share op based on the context it is used +func (m *HostgroupShareOp) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAdd(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostgroupShareOp) contextValidateAdd(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Add); i++ { + + if m.Add[i] != nil { + + if swag.IsZero(m.Add[i]) { // not required + return nil + } + + if err := m.Add[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("add" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("add" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HostgroupShareOp) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HostgroupShareOp) UnmarshalBinary(b []byte) error { + var res HostgroupShareOp + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/hostgroup_with_sharing_info.go b/power/models/hostgroup_with_sharing_info.go new file mode 100644 index 00000000..54de8fa7 --- /dev/null +++ b/power/models/hostgroup_with_sharing_info.go @@ -0,0 +1,146 @@ +// 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" +) + +// HostgroupWithSharingInfo Description of a hostgroup including sharing information +// +// swagger:model HostgroupWithSharingInfo +type HostgroupWithSharingInfo struct { + + // Date/Time of hostgroup creation + // Format: date-time + CreationDate strfmt.DateTime `json:"creationDate,omitempty"` + + // List of hosts + Hosts []HostHref `json:"hosts"` + + // Hostgroup ID + ID string `json:"id,omitempty"` + + // Name of the hostgroup + Name string `json:"name,omitempty"` + + // Name of the workspace owning the hostgroup + Primary string `json:"primary,omitempty"` + + // Names of workspaces the hostgroup has been shared with + Secondaries []string `json:"secondaries"` +} + +// Validate validates this hostgroup with sharing info +func (m *HostgroupWithSharingInfo) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreationDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHosts(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostgroupWithSharingInfo) validateCreationDate(formats strfmt.Registry) error { + if swag.IsZero(m.CreationDate) { // not required + return nil + } + + if err := validate.FormatOf("creationDate", "body", "date-time", m.CreationDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *HostgroupWithSharingInfo) validateHosts(formats strfmt.Registry) error { + if swag.IsZero(m.Hosts) { // not required + return nil + } + + for i := 0; i < len(m.Hosts); i++ { + + if err := m.Hosts[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hosts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("hosts" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +// ContextValidate validate this hostgroup with sharing info based on the context it is used +func (m *HostgroupWithSharingInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateHosts(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostgroupWithSharingInfo) contextValidateHosts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Hosts); i++ { + + if swag.IsZero(m.Hosts[i]) { // not required + return nil + } + + if err := m.Hosts[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hosts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("hosts" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HostgroupWithSharingInfo) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HostgroupWithSharingInfo) UnmarshalBinary(b []byte) error { + var res HostgroupWithSharingInfo + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/p_vm_instance_create.go b/power/models/p_vm_instance_create.go index aa2e73ac..01358861 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 { + // The name of the host or hostgroup where to deploy the VM + DeployTarget string `json:"deployTarget,omitempty"` + // The custom deployment type DeploymentType string `json:"deploymentType,omitempty"` diff --git a/power/models/secondary.go b/power/models/secondary.go new file mode 100644 index 00000000..11c37f88 --- /dev/null +++ b/power/models/secondary.go @@ -0,0 +1,74 @@ +// 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" +) + +// Secondary Information to create a secondary hostgroup +// +// swagger:model Secondary +type Secondary struct { + + // Name of the hostgroup to create in the secondary workspace + Name string `json:"name,omitempty"` + + // Name of the workspace to share the hostgroup with + // Required: true + Workspace *string `json:"workspace"` +} + +// Validate validates this secondary +func (m *Secondary) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateWorkspace(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Secondary) validateWorkspace(formats strfmt.Registry) error { + + if err := validate.Required("workspace", "body", m.Workspace); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this secondary based on context it is used +func (m *Secondary) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Secondary) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Secondary) UnmarshalBinary(b []byte) error { + var res Secondary + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +}