From 3d21f551755d0f7a3856fc5738c2666be1b27daa Mon Sep 17 00:00:00 2001 From: ismirlia <90468712+ismirlia@users.noreply.github.com> Date: Mon, 16 Sep 2024 12:26:24 -0500 Subject: [PATCH] Add network-interfaces for Q3 (#464) --- clients/instance/ibm-pi-network.go | 63 ++ power/client/networks/networks_client.go | 270 ++++++++ ...ks_network_interfaces_delete_parameters.go | 173 +++++ ...rks_network_interfaces_delete_responses.go | 560 +++++++++++++++ ...works_network_interfaces_get_parameters.go | 173 +++++ ...tworks_network_interfaces_get_responses.go | 486 +++++++++++++ ...ks_network_interfaces_getall_parameters.go | 151 +++++ ...rks_network_interfaces_getall_responses.go | 486 +++++++++++++ ...orks_network_interfaces_post_parameters.go | 175 +++++ ...works_network_interfaces_post_responses.go | 638 ++++++++++++++++++ ...works_network_interfaces_put_parameters.go | 197 ++++++ ...tworks_network_interfaces_put_responses.go | 562 +++++++++++++++ power/client/power_iaas_api_client.go | 5 + power/models/network_interface.go | 258 +++++++ power/models/network_interface_create.go | 56 ++ power/models/network_interface_update.go | 53 ++ power/models/network_interfaces.go | 124 ++++ 17 files changed, 4430 insertions(+) create mode 100644 power/client/networks/networks_client.go create mode 100644 power/client/networks/v1_networks_network_interfaces_delete_parameters.go create mode 100644 power/client/networks/v1_networks_network_interfaces_delete_responses.go create mode 100644 power/client/networks/v1_networks_network_interfaces_get_parameters.go create mode 100644 power/client/networks/v1_networks_network_interfaces_get_responses.go create mode 100644 power/client/networks/v1_networks_network_interfaces_getall_parameters.go create mode 100644 power/client/networks/v1_networks_network_interfaces_getall_responses.go create mode 100644 power/client/networks/v1_networks_network_interfaces_post_parameters.go create mode 100644 power/client/networks/v1_networks_network_interfaces_post_responses.go create mode 100644 power/client/networks/v1_networks_network_interfaces_put_parameters.go create mode 100644 power/client/networks/v1_networks_network_interfaces_put_responses.go create mode 100644 power/models/network_interface.go create mode 100644 power/models/network_interface_create.go create mode 100644 power/models/network_interface_update.go create mode 100644 power/models/network_interfaces.go diff --git a/clients/instance/ibm-pi-network.go b/clients/instance/ibm-pi-network.go index 1b823234..a813bc42 100644 --- a/clients/instance/ibm-pi-network.go +++ b/clients/instance/ibm-pi-network.go @@ -8,6 +8,7 @@ import ( "github.com/IBM-Cloud/power-go-client/helpers" "github.com/IBM-Cloud/power-go-client/ibmpisession" + "github.com/IBM-Cloud/power-go-client/power/client/networks" "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks" "github.com/IBM-Cloud/power-go-client/power/models" ) @@ -196,3 +197,65 @@ func (f *IBMPINetworkClient) UpdatePort(id, networkPortID string, body *models.N } return resp.Payload, nil } + +// Create a network interface +func (f *IBMPINetworkClient) CreateNetworkInterface(id string, body *models.NetworkInterfaceCreate) (*models.NetworkInterface, error) { + params := networks.NewV1NetworksNetworkInterfacesPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithNetworkID(id).WithBody(body) + resp, err := f.session.Power.Networks.V1NetworksNetworkInterfacesPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to create network interface for network %s with %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to create network interface for network %s", id) + } + return resp.Payload, nil +} + +// Get all Create a network interface +func (f *IBMPINetworkClient) GetAllNetworkInterfaces(id string) (*models.NetworkInterfaces, error) { + params := networks.NewV1NetworksNetworkInterfacesGetallParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithNetworkID(id) + resp, err := f.session.Power.Networks.V1NetworksNetworkInterfacesGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to get all network interfaces for network %s: %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get all network interfaces for network %s", id) + } + return resp.Payload, nil +} + +// Get a network interface +func (f *IBMPINetworkClient) GetNetworkInterface(id, netIntID string) (*models.NetworkInterface, error) { + params := networks.NewV1NetworksNetworkInterfacesGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithNetworkID(id).WithNetworkInterfaceID(netIntID) + resp, err := f.session.Power.Networks.V1NetworksNetworkInterfacesGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to get network interace %s for network %s: %w", netIntID, id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get network interface %s for network %s", netIntID, id) + } + return resp.Payload, nil +} + +// Update a network interface +func (f *IBMPINetworkClient) UpdateNetworkInterface(id, netIntID string, body *models.NetworkInterfaceUpdate) (*models.NetworkInterface, error) { + params := networks.NewV1NetworksNetworkInterfacesPutParams().WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut).WithNetworkID(id).WithNetworkInterfaceID(netIntID).WithBody(body) + resp, err := f.session.Power.Networks.V1NetworksNetworkInterfacesPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to update network interface %s and network %s with error %w", netIntID, id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to update network interface %s and network %s", netIntID, id) + } + return resp.Payload, nil +} + +// Delete a network interface +func (f *IBMPINetworkClient) DeleteNetworkInterface(id, netIntID string) error { + params := networks.NewV1NetworksNetworkInterfacesDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut).WithNetworkID(id).WithNetworkInterfaceID(netIntID) + _, err := f.session.Power.Networks.V1NetworksNetworkInterfacesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf("failed to delete network interface %s for network %s with error %w", netIntID, id, err) + } + return nil +} diff --git a/power/client/networks/networks_client.go b/power/client/networks/networks_client.go new file mode 100644 index 00000000..3358bc96 --- /dev/null +++ b/power/client/networks/networks_client.go @@ -0,0 +1,270 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// 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" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new networks API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new networks API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new networks API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for networks API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + V1NetworksNetworkInterfacesDelete(params *V1NetworksNetworkInterfacesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworksNetworkInterfacesDeleteOK, error) + + V1NetworksNetworkInterfacesGet(params *V1NetworksNetworkInterfacesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworksNetworkInterfacesGetOK, error) + + V1NetworksNetworkInterfacesGetall(params *V1NetworksNetworkInterfacesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworksNetworkInterfacesGetallOK, error) + + V1NetworksNetworkInterfacesPost(params *V1NetworksNetworkInterfacesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworksNetworkInterfacesPostCreated, error) + + V1NetworksNetworkInterfacesPut(params *V1NetworksNetworkInterfacesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworksNetworkInterfacesPutOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +V1NetworksNetworkInterfacesDelete deletes a network interface +*/ +func (a *Client) V1NetworksNetworkInterfacesDelete(params *V1NetworksNetworkInterfacesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworksNetworkInterfacesDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworksNetworkInterfacesDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networks.network-interfaces.delete", + Method: "DELETE", + PathPattern: "/v1/networks/{network_id}/network-interfaces/{network_interface_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworksNetworkInterfacesDeleteReader{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.(*V1NetworksNetworkInterfacesDeleteOK) + 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.networks.network-interfaces.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworksNetworkInterfacesGet gets a network interface s information +*/ +func (a *Client) V1NetworksNetworkInterfacesGet(params *V1NetworksNetworkInterfacesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworksNetworkInterfacesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworksNetworkInterfacesGetParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networks.network-interfaces.get", + Method: "GET", + PathPattern: "/v1/networks/{network_id}/network-interfaces/{network_interface_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworksNetworkInterfacesGetReader{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.(*V1NetworksNetworkInterfacesGetOK) + 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.networks.network-interfaces.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworksNetworkInterfacesGetall gets all network interfaces for this network +*/ +func (a *Client) V1NetworksNetworkInterfacesGetall(params *V1NetworksNetworkInterfacesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworksNetworkInterfacesGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworksNetworkInterfacesGetallParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networks.network-interfaces.getall", + Method: "GET", + PathPattern: "/v1/networks/{network_id}/network-interfaces", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworksNetworkInterfacesGetallReader{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.(*V1NetworksNetworkInterfacesGetallOK) + 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.networks.network-interfaces.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworksNetworkInterfacesPost performs network interface addition deletion and listing +*/ +func (a *Client) V1NetworksNetworkInterfacesPost(params *V1NetworksNetworkInterfacesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworksNetworkInterfacesPostCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworksNetworkInterfacesPostParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networks.network-interfaces.post", + Method: "POST", + PathPattern: "/v1/networks/{network_id}/network-interfaces", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworksNetworkInterfacesPostReader{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.(*V1NetworksNetworkInterfacesPostCreated) + 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.networks.network-interfaces.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworksNetworkInterfacesPut updates a network interface s information +*/ +func (a *Client) V1NetworksNetworkInterfacesPut(params *V1NetworksNetworkInterfacesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworksNetworkInterfacesPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworksNetworkInterfacesPutParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networks.network-interfaces.put", + Method: "PUT", + PathPattern: "/v1/networks/{network_id}/network-interfaces/{network_interface_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworksNetworkInterfacesPutReader{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.(*V1NetworksNetworkInterfacesPutOK) + 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.networks.network-interfaces.put: 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/networks/v1_networks_network_interfaces_delete_parameters.go b/power/client/networks/v1_networks_network_interfaces_delete_parameters.go new file mode 100644 index 00000000..e68d59ee --- /dev/null +++ b/power/client/networks/v1_networks_network_interfaces_delete_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// 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" +) + +// NewV1NetworksNetworkInterfacesDeleteParams creates a new V1NetworksNetworkInterfacesDeleteParams 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 NewV1NetworksNetworkInterfacesDeleteParams() *V1NetworksNetworkInterfacesDeleteParams { + return &V1NetworksNetworkInterfacesDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworksNetworkInterfacesDeleteParamsWithTimeout creates a new V1NetworksNetworkInterfacesDeleteParams object +// with the ability to set a timeout on a request. +func NewV1NetworksNetworkInterfacesDeleteParamsWithTimeout(timeout time.Duration) *V1NetworksNetworkInterfacesDeleteParams { + return &V1NetworksNetworkInterfacesDeleteParams{ + timeout: timeout, + } +} + +// NewV1NetworksNetworkInterfacesDeleteParamsWithContext creates a new V1NetworksNetworkInterfacesDeleteParams object +// with the ability to set a context for a request. +func NewV1NetworksNetworkInterfacesDeleteParamsWithContext(ctx context.Context) *V1NetworksNetworkInterfacesDeleteParams { + return &V1NetworksNetworkInterfacesDeleteParams{ + Context: ctx, + } +} + +// NewV1NetworksNetworkInterfacesDeleteParamsWithHTTPClient creates a new V1NetworksNetworkInterfacesDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworksNetworkInterfacesDeleteParamsWithHTTPClient(client *http.Client) *V1NetworksNetworkInterfacesDeleteParams { + return &V1NetworksNetworkInterfacesDeleteParams{ + HTTPClient: client, + } +} + +/* +V1NetworksNetworkInterfacesDeleteParams contains all the parameters to send to the API endpoint + + for the v1 networks network interfaces delete operation. + + Typically these are written to a http.Request. +*/ +type V1NetworksNetworkInterfacesDeleteParams struct { + + /* NetworkID. + + Network ID + */ + NetworkID string + + /* NetworkInterfaceID. + + Network Interface ID + */ + NetworkInterfaceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 networks network interfaces delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworksNetworkInterfacesDeleteParams) WithDefaults() *V1NetworksNetworkInterfacesDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 networks network interfaces delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworksNetworkInterfacesDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 networks network interfaces delete params +func (o *V1NetworksNetworkInterfacesDeleteParams) WithTimeout(timeout time.Duration) *V1NetworksNetworkInterfacesDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 networks network interfaces delete params +func (o *V1NetworksNetworkInterfacesDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 networks network interfaces delete params +func (o *V1NetworksNetworkInterfacesDeleteParams) WithContext(ctx context.Context) *V1NetworksNetworkInterfacesDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 networks network interfaces delete params +func (o *V1NetworksNetworkInterfacesDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 networks network interfaces delete params +func (o *V1NetworksNetworkInterfacesDeleteParams) WithHTTPClient(client *http.Client) *V1NetworksNetworkInterfacesDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 networks network interfaces delete params +func (o *V1NetworksNetworkInterfacesDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNetworkID adds the networkID to the v1 networks network interfaces delete params +func (o *V1NetworksNetworkInterfacesDeleteParams) WithNetworkID(networkID string) *V1NetworksNetworkInterfacesDeleteParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the v1 networks network interfaces delete params +func (o *V1NetworksNetworkInterfacesDeleteParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WithNetworkInterfaceID adds the networkInterfaceID to the v1 networks network interfaces delete params +func (o *V1NetworksNetworkInterfacesDeleteParams) WithNetworkInterfaceID(networkInterfaceID string) *V1NetworksNetworkInterfacesDeleteParams { + o.SetNetworkInterfaceID(networkInterfaceID) + return o +} + +// SetNetworkInterfaceID adds the networkInterfaceId to the v1 networks network interfaces delete params +func (o *V1NetworksNetworkInterfacesDeleteParams) SetNetworkInterfaceID(networkInterfaceID string) { + o.NetworkInterfaceID = networkInterfaceID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworksNetworkInterfacesDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + // path param network_interface_id + if err := r.SetPathParam("network_interface_id", o.NetworkInterfaceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/networks/v1_networks_network_interfaces_delete_responses.go b/power/client/networks/v1_networks_network_interfaces_delete_responses.go new file mode 100644 index 00000000..8c525d4a --- /dev/null +++ b/power/client/networks/v1_networks_network_interfaces_delete_responses.go @@ -0,0 +1,560 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworksNetworkInterfacesDeleteReader is a Reader for the V1NetworksNetworkInterfacesDelete structure. +type V1NetworksNetworkInterfacesDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworksNetworkInterfacesDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworksNetworkInterfacesDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworksNetworkInterfacesDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworksNetworkInterfacesDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworksNetworkInterfacesDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworksNetworkInterfacesDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 410: + result := NewV1NetworksNetworkInterfacesDeleteGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworksNetworkInterfacesDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}] v1.networks.network-interfaces.delete", response, response.Code()) + } +} + +// NewV1NetworksNetworkInterfacesDeleteOK creates a V1NetworksNetworkInterfacesDeleteOK with default headers values +func NewV1NetworksNetworkInterfacesDeleteOK() *V1NetworksNetworkInterfacesDeleteOK { + return &V1NetworksNetworkInterfacesDeleteOK{} +} + +/* +V1NetworksNetworkInterfacesDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworksNetworkInterfacesDeleteOK struct { + Payload models.Object +} + +// IsSuccess returns true when this v1 networks network interfaces delete o k response has a 2xx status code +func (o *V1NetworksNetworkInterfacesDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 networks network interfaces delete o k response has a 3xx status code +func (o *V1NetworksNetworkInterfacesDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces delete o k response has a 4xx status code +func (o *V1NetworksNetworkInterfacesDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 networks network interfaces delete o k response has a 5xx status code +func (o *V1NetworksNetworkInterfacesDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces delete o k response a status code equal to that given +func (o *V1NetworksNetworkInterfacesDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 networks network interfaces delete o k response +func (o *V1NetworksNetworkInterfacesDeleteOK) Code() int { + return 200 +} + +func (o *V1NetworksNetworkInterfacesDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteOK %s", 200, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteOK %s", 200, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesDeleteOK) 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 +} + +// NewV1NetworksNetworkInterfacesDeleteBadRequest creates a V1NetworksNetworkInterfacesDeleteBadRequest with default headers values +func NewV1NetworksNetworkInterfacesDeleteBadRequest() *V1NetworksNetworkInterfacesDeleteBadRequest { + return &V1NetworksNetworkInterfacesDeleteBadRequest{} +} + +/* +V1NetworksNetworkInterfacesDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworksNetworkInterfacesDeleteBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces delete bad request response has a 2xx status code +func (o *V1NetworksNetworkInterfacesDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces delete bad request response has a 3xx status code +func (o *V1NetworksNetworkInterfacesDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces delete bad request response has a 4xx status code +func (o *V1NetworksNetworkInterfacesDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces delete bad request response has a 5xx status code +func (o *V1NetworksNetworkInterfacesDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces delete bad request response a status code equal to that given +func (o *V1NetworksNetworkInterfacesDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 networks network interfaces delete bad request response +func (o *V1NetworksNetworkInterfacesDeleteBadRequest) Code() int { + return 400 +} + +func (o *V1NetworksNetworkInterfacesDeleteBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesDeleteBadRequest) 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 +} + +// NewV1NetworksNetworkInterfacesDeleteUnauthorized creates a V1NetworksNetworkInterfacesDeleteUnauthorized with default headers values +func NewV1NetworksNetworkInterfacesDeleteUnauthorized() *V1NetworksNetworkInterfacesDeleteUnauthorized { + return &V1NetworksNetworkInterfacesDeleteUnauthorized{} +} + +/* +V1NetworksNetworkInterfacesDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworksNetworkInterfacesDeleteUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces delete unauthorized response has a 2xx status code +func (o *V1NetworksNetworkInterfacesDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces delete unauthorized response has a 3xx status code +func (o *V1NetworksNetworkInterfacesDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces delete unauthorized response has a 4xx status code +func (o *V1NetworksNetworkInterfacesDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces delete unauthorized response has a 5xx status code +func (o *V1NetworksNetworkInterfacesDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces delete unauthorized response a status code equal to that given +func (o *V1NetworksNetworkInterfacesDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 networks network interfaces delete unauthorized response +func (o *V1NetworksNetworkInterfacesDeleteUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworksNetworkInterfacesDeleteUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesDeleteUnauthorized) 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 +} + +// NewV1NetworksNetworkInterfacesDeleteForbidden creates a V1NetworksNetworkInterfacesDeleteForbidden with default headers values +func NewV1NetworksNetworkInterfacesDeleteForbidden() *V1NetworksNetworkInterfacesDeleteForbidden { + return &V1NetworksNetworkInterfacesDeleteForbidden{} +} + +/* +V1NetworksNetworkInterfacesDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworksNetworkInterfacesDeleteForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces delete forbidden response has a 2xx status code +func (o *V1NetworksNetworkInterfacesDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces delete forbidden response has a 3xx status code +func (o *V1NetworksNetworkInterfacesDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces delete forbidden response has a 4xx status code +func (o *V1NetworksNetworkInterfacesDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces delete forbidden response has a 5xx status code +func (o *V1NetworksNetworkInterfacesDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces delete forbidden response a status code equal to that given +func (o *V1NetworksNetworkInterfacesDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 networks network interfaces delete forbidden response +func (o *V1NetworksNetworkInterfacesDeleteForbidden) Code() int { + return 403 +} + +func (o *V1NetworksNetworkInterfacesDeleteForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesDeleteForbidden) 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 +} + +// NewV1NetworksNetworkInterfacesDeleteNotFound creates a V1NetworksNetworkInterfacesDeleteNotFound with default headers values +func NewV1NetworksNetworkInterfacesDeleteNotFound() *V1NetworksNetworkInterfacesDeleteNotFound { + return &V1NetworksNetworkInterfacesDeleteNotFound{} +} + +/* +V1NetworksNetworkInterfacesDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworksNetworkInterfacesDeleteNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces delete not found response has a 2xx status code +func (o *V1NetworksNetworkInterfacesDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces delete not found response has a 3xx status code +func (o *V1NetworksNetworkInterfacesDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces delete not found response has a 4xx status code +func (o *V1NetworksNetworkInterfacesDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces delete not found response has a 5xx status code +func (o *V1NetworksNetworkInterfacesDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces delete not found response a status code equal to that given +func (o *V1NetworksNetworkInterfacesDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 networks network interfaces delete not found response +func (o *V1NetworksNetworkInterfacesDeleteNotFound) Code() int { + return 404 +} + +func (o *V1NetworksNetworkInterfacesDeleteNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesDeleteNotFound) 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 +} + +// NewV1NetworksNetworkInterfacesDeleteGone creates a V1NetworksNetworkInterfacesDeleteGone with default headers values +func NewV1NetworksNetworkInterfacesDeleteGone() *V1NetworksNetworkInterfacesDeleteGone { + return &V1NetworksNetworkInterfacesDeleteGone{} +} + +/* +V1NetworksNetworkInterfacesDeleteGone describes a response with status code 410, with default header values. + +Gone +*/ +type V1NetworksNetworkInterfacesDeleteGone struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces delete gone response has a 2xx status code +func (o *V1NetworksNetworkInterfacesDeleteGone) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces delete gone response has a 3xx status code +func (o *V1NetworksNetworkInterfacesDeleteGone) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces delete gone response has a 4xx status code +func (o *V1NetworksNetworkInterfacesDeleteGone) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces delete gone response has a 5xx status code +func (o *V1NetworksNetworkInterfacesDeleteGone) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces delete gone response a status code equal to that given +func (o *V1NetworksNetworkInterfacesDeleteGone) IsCode(code int) bool { + return code == 410 +} + +// Code gets the status code for the v1 networks network interfaces delete gone response +func (o *V1NetworksNetworkInterfacesDeleteGone) Code() int { + return 410 +} + +func (o *V1NetworksNetworkInterfacesDeleteGone) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteGone %s", 410, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteGone) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteGone %s", 410, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesDeleteGone) 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 +} + +// NewV1NetworksNetworkInterfacesDeleteInternalServerError creates a V1NetworksNetworkInterfacesDeleteInternalServerError with default headers values +func NewV1NetworksNetworkInterfacesDeleteInternalServerError() *V1NetworksNetworkInterfacesDeleteInternalServerError { + return &V1NetworksNetworkInterfacesDeleteInternalServerError{} +} + +/* +V1NetworksNetworkInterfacesDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworksNetworkInterfacesDeleteInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces delete internal server error response has a 2xx status code +func (o *V1NetworksNetworkInterfacesDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces delete internal server error response has a 3xx status code +func (o *V1NetworksNetworkInterfacesDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces delete internal server error response has a 4xx status code +func (o *V1NetworksNetworkInterfacesDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 networks network interfaces delete internal server error response has a 5xx status code +func (o *V1NetworksNetworkInterfacesDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 networks network interfaces delete internal server error response a status code equal to that given +func (o *V1NetworksNetworkInterfacesDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 networks network interfaces delete internal server error response +func (o *V1NetworksNetworkInterfacesDeleteInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworksNetworkInterfacesDeleteInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesDeleteInternalServerError) 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/networks/v1_networks_network_interfaces_get_parameters.go b/power/client/networks/v1_networks_network_interfaces_get_parameters.go new file mode 100644 index 00000000..431fd192 --- /dev/null +++ b/power/client/networks/v1_networks_network_interfaces_get_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// 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" +) + +// NewV1NetworksNetworkInterfacesGetParams creates a new V1NetworksNetworkInterfacesGetParams 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 NewV1NetworksNetworkInterfacesGetParams() *V1NetworksNetworkInterfacesGetParams { + return &V1NetworksNetworkInterfacesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworksNetworkInterfacesGetParamsWithTimeout creates a new V1NetworksNetworkInterfacesGetParams object +// with the ability to set a timeout on a request. +func NewV1NetworksNetworkInterfacesGetParamsWithTimeout(timeout time.Duration) *V1NetworksNetworkInterfacesGetParams { + return &V1NetworksNetworkInterfacesGetParams{ + timeout: timeout, + } +} + +// NewV1NetworksNetworkInterfacesGetParamsWithContext creates a new V1NetworksNetworkInterfacesGetParams object +// with the ability to set a context for a request. +func NewV1NetworksNetworkInterfacesGetParamsWithContext(ctx context.Context) *V1NetworksNetworkInterfacesGetParams { + return &V1NetworksNetworkInterfacesGetParams{ + Context: ctx, + } +} + +// NewV1NetworksNetworkInterfacesGetParamsWithHTTPClient creates a new V1NetworksNetworkInterfacesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworksNetworkInterfacesGetParamsWithHTTPClient(client *http.Client) *V1NetworksNetworkInterfacesGetParams { + return &V1NetworksNetworkInterfacesGetParams{ + HTTPClient: client, + } +} + +/* +V1NetworksNetworkInterfacesGetParams contains all the parameters to send to the API endpoint + + for the v1 networks network interfaces get operation. + + Typically these are written to a http.Request. +*/ +type V1NetworksNetworkInterfacesGetParams struct { + + /* NetworkID. + + Network ID + */ + NetworkID string + + /* NetworkInterfaceID. + + Network Interface ID + */ + NetworkInterfaceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 networks network interfaces get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworksNetworkInterfacesGetParams) WithDefaults() *V1NetworksNetworkInterfacesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 networks network interfaces get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworksNetworkInterfacesGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 networks network interfaces get params +func (o *V1NetworksNetworkInterfacesGetParams) WithTimeout(timeout time.Duration) *V1NetworksNetworkInterfacesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 networks network interfaces get params +func (o *V1NetworksNetworkInterfacesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 networks network interfaces get params +func (o *V1NetworksNetworkInterfacesGetParams) WithContext(ctx context.Context) *V1NetworksNetworkInterfacesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 networks network interfaces get params +func (o *V1NetworksNetworkInterfacesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 networks network interfaces get params +func (o *V1NetworksNetworkInterfacesGetParams) WithHTTPClient(client *http.Client) *V1NetworksNetworkInterfacesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 networks network interfaces get params +func (o *V1NetworksNetworkInterfacesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNetworkID adds the networkID to the v1 networks network interfaces get params +func (o *V1NetworksNetworkInterfacesGetParams) WithNetworkID(networkID string) *V1NetworksNetworkInterfacesGetParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the v1 networks network interfaces get params +func (o *V1NetworksNetworkInterfacesGetParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WithNetworkInterfaceID adds the networkInterfaceID to the v1 networks network interfaces get params +func (o *V1NetworksNetworkInterfacesGetParams) WithNetworkInterfaceID(networkInterfaceID string) *V1NetworksNetworkInterfacesGetParams { + o.SetNetworkInterfaceID(networkInterfaceID) + return o +} + +// SetNetworkInterfaceID adds the networkInterfaceId to the v1 networks network interfaces get params +func (o *V1NetworksNetworkInterfacesGetParams) SetNetworkInterfaceID(networkInterfaceID string) { + o.NetworkInterfaceID = networkInterfaceID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworksNetworkInterfacesGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + // path param network_interface_id + if err := r.SetPathParam("network_interface_id", o.NetworkInterfaceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/networks/v1_networks_network_interfaces_get_responses.go b/power/client/networks/v1_networks_network_interfaces_get_responses.go new file mode 100644 index 00000000..8efe1ce3 --- /dev/null +++ b/power/client/networks/v1_networks_network_interfaces_get_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworksNetworkInterfacesGetReader is a Reader for the V1NetworksNetworkInterfacesGet structure. +type V1NetworksNetworkInterfacesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworksNetworkInterfacesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworksNetworkInterfacesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworksNetworkInterfacesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworksNetworkInterfacesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworksNetworkInterfacesGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworksNetworkInterfacesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworksNetworkInterfacesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}] v1.networks.network-interfaces.get", response, response.Code()) + } +} + +// NewV1NetworksNetworkInterfacesGetOK creates a V1NetworksNetworkInterfacesGetOK with default headers values +func NewV1NetworksNetworkInterfacesGetOK() *V1NetworksNetworkInterfacesGetOK { + return &V1NetworksNetworkInterfacesGetOK{} +} + +/* +V1NetworksNetworkInterfacesGetOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworksNetworkInterfacesGetOK struct { + Payload *models.NetworkInterface +} + +// IsSuccess returns true when this v1 networks network interfaces get o k response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 networks network interfaces get o k response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces get o k response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 networks network interfaces get o k response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces get o k response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 networks network interfaces get o k response +func (o *V1NetworksNetworkInterfacesGetOK) Code() int { + return 200 +} + +func (o *V1NetworksNetworkInterfacesGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetOK %s", 200, payload) +} + +func (o *V1NetworksNetworkInterfacesGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetOK %s", 200, payload) +} + +func (o *V1NetworksNetworkInterfacesGetOK) GetPayload() *models.NetworkInterface { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkInterface) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesGetBadRequest creates a V1NetworksNetworkInterfacesGetBadRequest with default headers values +func NewV1NetworksNetworkInterfacesGetBadRequest() *V1NetworksNetworkInterfacesGetBadRequest { + return &V1NetworksNetworkInterfacesGetBadRequest{} +} + +/* +V1NetworksNetworkInterfacesGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworksNetworkInterfacesGetBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces get bad request response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces get bad request response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces get bad request response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces get bad request response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces get bad request response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 networks network interfaces get bad request response +func (o *V1NetworksNetworkInterfacesGetBadRequest) Code() int { + return 400 +} + +func (o *V1NetworksNetworkInterfacesGetBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetBadRequest %s", 400, payload) +} + +func (o *V1NetworksNetworkInterfacesGetBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetBadRequest %s", 400, payload) +} + +func (o *V1NetworksNetworkInterfacesGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetBadRequest) 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 +} + +// NewV1NetworksNetworkInterfacesGetUnauthorized creates a V1NetworksNetworkInterfacesGetUnauthorized with default headers values +func NewV1NetworksNetworkInterfacesGetUnauthorized() *V1NetworksNetworkInterfacesGetUnauthorized { + return &V1NetworksNetworkInterfacesGetUnauthorized{} +} + +/* +V1NetworksNetworkInterfacesGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworksNetworkInterfacesGetUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces get unauthorized response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces get unauthorized response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces get unauthorized response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces get unauthorized response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces get unauthorized response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 networks network interfaces get unauthorized response +func (o *V1NetworksNetworkInterfacesGetUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworksNetworkInterfacesGetUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetUnauthorized %s", 401, payload) +} + +func (o *V1NetworksNetworkInterfacesGetUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetUnauthorized %s", 401, payload) +} + +func (o *V1NetworksNetworkInterfacesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetUnauthorized) 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 +} + +// NewV1NetworksNetworkInterfacesGetForbidden creates a V1NetworksNetworkInterfacesGetForbidden with default headers values +func NewV1NetworksNetworkInterfacesGetForbidden() *V1NetworksNetworkInterfacesGetForbidden { + return &V1NetworksNetworkInterfacesGetForbidden{} +} + +/* +V1NetworksNetworkInterfacesGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworksNetworkInterfacesGetForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces get forbidden response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces get forbidden response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces get forbidden response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces get forbidden response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces get forbidden response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 networks network interfaces get forbidden response +func (o *V1NetworksNetworkInterfacesGetForbidden) Code() int { + return 403 +} + +func (o *V1NetworksNetworkInterfacesGetForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetForbidden %s", 403, payload) +} + +func (o *V1NetworksNetworkInterfacesGetForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetForbidden %s", 403, payload) +} + +func (o *V1NetworksNetworkInterfacesGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetForbidden) 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 +} + +// NewV1NetworksNetworkInterfacesGetNotFound creates a V1NetworksNetworkInterfacesGetNotFound with default headers values +func NewV1NetworksNetworkInterfacesGetNotFound() *V1NetworksNetworkInterfacesGetNotFound { + return &V1NetworksNetworkInterfacesGetNotFound{} +} + +/* +V1NetworksNetworkInterfacesGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworksNetworkInterfacesGetNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces get not found response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces get not found response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces get not found response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces get not found response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces get not found response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 networks network interfaces get not found response +func (o *V1NetworksNetworkInterfacesGetNotFound) Code() int { + return 404 +} + +func (o *V1NetworksNetworkInterfacesGetNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetNotFound %s", 404, payload) +} + +func (o *V1NetworksNetworkInterfacesGetNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetNotFound %s", 404, payload) +} + +func (o *V1NetworksNetworkInterfacesGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetNotFound) 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 +} + +// NewV1NetworksNetworkInterfacesGetInternalServerError creates a V1NetworksNetworkInterfacesGetInternalServerError with default headers values +func NewV1NetworksNetworkInterfacesGetInternalServerError() *V1NetworksNetworkInterfacesGetInternalServerError { + return &V1NetworksNetworkInterfacesGetInternalServerError{} +} + +/* +V1NetworksNetworkInterfacesGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworksNetworkInterfacesGetInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces get internal server error response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces get internal server error response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces get internal server error response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 networks network interfaces get internal server error response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 networks network interfaces get internal server error response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 networks network interfaces get internal server error response +func (o *V1NetworksNetworkInterfacesGetInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworksNetworkInterfacesGetInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetInternalServerError %s", 500, payload) +} + +func (o *V1NetworksNetworkInterfacesGetInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetInternalServerError %s", 500, payload) +} + +func (o *V1NetworksNetworkInterfacesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetInternalServerError) 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/networks/v1_networks_network_interfaces_getall_parameters.go b/power/client/networks/v1_networks_network_interfaces_getall_parameters.go new file mode 100644 index 00000000..2e7b75a2 --- /dev/null +++ b/power/client/networks/v1_networks_network_interfaces_getall_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// 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" +) + +// NewV1NetworksNetworkInterfacesGetallParams creates a new V1NetworksNetworkInterfacesGetallParams 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 NewV1NetworksNetworkInterfacesGetallParams() *V1NetworksNetworkInterfacesGetallParams { + return &V1NetworksNetworkInterfacesGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworksNetworkInterfacesGetallParamsWithTimeout creates a new V1NetworksNetworkInterfacesGetallParams object +// with the ability to set a timeout on a request. +func NewV1NetworksNetworkInterfacesGetallParamsWithTimeout(timeout time.Duration) *V1NetworksNetworkInterfacesGetallParams { + return &V1NetworksNetworkInterfacesGetallParams{ + timeout: timeout, + } +} + +// NewV1NetworksNetworkInterfacesGetallParamsWithContext creates a new V1NetworksNetworkInterfacesGetallParams object +// with the ability to set a context for a request. +func NewV1NetworksNetworkInterfacesGetallParamsWithContext(ctx context.Context) *V1NetworksNetworkInterfacesGetallParams { + return &V1NetworksNetworkInterfacesGetallParams{ + Context: ctx, + } +} + +// NewV1NetworksNetworkInterfacesGetallParamsWithHTTPClient creates a new V1NetworksNetworkInterfacesGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworksNetworkInterfacesGetallParamsWithHTTPClient(client *http.Client) *V1NetworksNetworkInterfacesGetallParams { + return &V1NetworksNetworkInterfacesGetallParams{ + HTTPClient: client, + } +} + +/* +V1NetworksNetworkInterfacesGetallParams contains all the parameters to send to the API endpoint + + for the v1 networks network interfaces getall operation. + + Typically these are written to a http.Request. +*/ +type V1NetworksNetworkInterfacesGetallParams struct { + + /* NetworkID. + + Network ID + */ + NetworkID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 networks network interfaces getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworksNetworkInterfacesGetallParams) WithDefaults() *V1NetworksNetworkInterfacesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 networks network interfaces getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworksNetworkInterfacesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 networks network interfaces getall params +func (o *V1NetworksNetworkInterfacesGetallParams) WithTimeout(timeout time.Duration) *V1NetworksNetworkInterfacesGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 networks network interfaces getall params +func (o *V1NetworksNetworkInterfacesGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 networks network interfaces getall params +func (o *V1NetworksNetworkInterfacesGetallParams) WithContext(ctx context.Context) *V1NetworksNetworkInterfacesGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 networks network interfaces getall params +func (o *V1NetworksNetworkInterfacesGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 networks network interfaces getall params +func (o *V1NetworksNetworkInterfacesGetallParams) WithHTTPClient(client *http.Client) *V1NetworksNetworkInterfacesGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 networks network interfaces getall params +func (o *V1NetworksNetworkInterfacesGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNetworkID adds the networkID to the v1 networks network interfaces getall params +func (o *V1NetworksNetworkInterfacesGetallParams) WithNetworkID(networkID string) *V1NetworksNetworkInterfacesGetallParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the v1 networks network interfaces getall params +func (o *V1NetworksNetworkInterfacesGetallParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworksNetworkInterfacesGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/networks/v1_networks_network_interfaces_getall_responses.go b/power/client/networks/v1_networks_network_interfaces_getall_responses.go new file mode 100644 index 00000000..753cc0a9 --- /dev/null +++ b/power/client/networks/v1_networks_network_interfaces_getall_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworksNetworkInterfacesGetallReader is a Reader for the V1NetworksNetworkInterfacesGetall structure. +type V1NetworksNetworkInterfacesGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworksNetworkInterfacesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworksNetworkInterfacesGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworksNetworkInterfacesGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworksNetworkInterfacesGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworksNetworkInterfacesGetallForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworksNetworkInterfacesGetallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworksNetworkInterfacesGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/networks/{network_id}/network-interfaces] v1.networks.network-interfaces.getall", response, response.Code()) + } +} + +// NewV1NetworksNetworkInterfacesGetallOK creates a V1NetworksNetworkInterfacesGetallOK with default headers values +func NewV1NetworksNetworkInterfacesGetallOK() *V1NetworksNetworkInterfacesGetallOK { + return &V1NetworksNetworkInterfacesGetallOK{} +} + +/* +V1NetworksNetworkInterfacesGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworksNetworkInterfacesGetallOK struct { + Payload *models.NetworkInterfaces +} + +// IsSuccess returns true when this v1 networks network interfaces getall o k response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetallOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 networks network interfaces getall o k response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetallOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces getall o k response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetallOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 networks network interfaces getall o k response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetallOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces getall o k response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetallOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 networks network interfaces getall o k response +func (o *V1NetworksNetworkInterfacesGetallOK) Code() int { + return 200 +} + +func (o *V1NetworksNetworkInterfacesGetallOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallOK %s", 200, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallOK %s", 200, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallOK) GetPayload() *models.NetworkInterfaces { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkInterfaces) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesGetallBadRequest creates a V1NetworksNetworkInterfacesGetallBadRequest with default headers values +func NewV1NetworksNetworkInterfacesGetallBadRequest() *V1NetworksNetworkInterfacesGetallBadRequest { + return &V1NetworksNetworkInterfacesGetallBadRequest{} +} + +/* +V1NetworksNetworkInterfacesGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworksNetworkInterfacesGetallBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces getall bad request response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetallBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces getall bad request response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetallBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces getall bad request response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetallBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces getall bad request response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetallBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces getall bad request response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetallBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 networks network interfaces getall bad request response +func (o *V1NetworksNetworkInterfacesGetallBadRequest) Code() int { + return 400 +} + +func (o *V1NetworksNetworkInterfacesGetallBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallBadRequest %s", 400, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallBadRequest %s", 400, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetallBadRequest) 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 +} + +// NewV1NetworksNetworkInterfacesGetallUnauthorized creates a V1NetworksNetworkInterfacesGetallUnauthorized with default headers values +func NewV1NetworksNetworkInterfacesGetallUnauthorized() *V1NetworksNetworkInterfacesGetallUnauthorized { + return &V1NetworksNetworkInterfacesGetallUnauthorized{} +} + +/* +V1NetworksNetworkInterfacesGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworksNetworkInterfacesGetallUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces getall unauthorized response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetallUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces getall unauthorized response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetallUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces getall unauthorized response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetallUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces getall unauthorized response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetallUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces getall unauthorized response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetallUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 networks network interfaces getall unauthorized response +func (o *V1NetworksNetworkInterfacesGetallUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworksNetworkInterfacesGetallUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallUnauthorized %s", 401, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallUnauthorized %s", 401, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetallUnauthorized) 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 +} + +// NewV1NetworksNetworkInterfacesGetallForbidden creates a V1NetworksNetworkInterfacesGetallForbidden with default headers values +func NewV1NetworksNetworkInterfacesGetallForbidden() *V1NetworksNetworkInterfacesGetallForbidden { + return &V1NetworksNetworkInterfacesGetallForbidden{} +} + +/* +V1NetworksNetworkInterfacesGetallForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworksNetworkInterfacesGetallForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces getall forbidden response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetallForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces getall forbidden response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetallForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces getall forbidden response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetallForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces getall forbidden response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetallForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces getall forbidden response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetallForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 networks network interfaces getall forbidden response +func (o *V1NetworksNetworkInterfacesGetallForbidden) Code() int { + return 403 +} + +func (o *V1NetworksNetworkInterfacesGetallForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallForbidden %s", 403, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallForbidden %s", 403, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetallForbidden) 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 +} + +// NewV1NetworksNetworkInterfacesGetallNotFound creates a V1NetworksNetworkInterfacesGetallNotFound with default headers values +func NewV1NetworksNetworkInterfacesGetallNotFound() *V1NetworksNetworkInterfacesGetallNotFound { + return &V1NetworksNetworkInterfacesGetallNotFound{} +} + +/* +V1NetworksNetworkInterfacesGetallNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworksNetworkInterfacesGetallNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces getall not found response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetallNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces getall not found response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetallNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces getall not found response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetallNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces getall not found response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetallNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces getall not found response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetallNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 networks network interfaces getall not found response +func (o *V1NetworksNetworkInterfacesGetallNotFound) Code() int { + return 404 +} + +func (o *V1NetworksNetworkInterfacesGetallNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallNotFound %s", 404, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallNotFound %s", 404, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetallNotFound) 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 +} + +// NewV1NetworksNetworkInterfacesGetallInternalServerError creates a V1NetworksNetworkInterfacesGetallInternalServerError with default headers values +func NewV1NetworksNetworkInterfacesGetallInternalServerError() *V1NetworksNetworkInterfacesGetallInternalServerError { + return &V1NetworksNetworkInterfacesGetallInternalServerError{} +} + +/* +V1NetworksNetworkInterfacesGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworksNetworkInterfacesGetallInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces getall internal server error response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetallInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces getall internal server error response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetallInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces getall internal server error response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetallInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 networks network interfaces getall internal server error response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetallInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 networks network interfaces getall internal server error response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetallInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 networks network interfaces getall internal server error response +func (o *V1NetworksNetworkInterfacesGetallInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworksNetworkInterfacesGetallInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallInternalServerError %s", 500, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallInternalServerError %s", 500, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetallInternalServerError) 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/networks/v1_networks_network_interfaces_post_parameters.go b/power/client/networks/v1_networks_network_interfaces_post_parameters.go new file mode 100644 index 00000000..46a62892 --- /dev/null +++ b/power/client/networks/v1_networks_network_interfaces_post_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// 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" +) + +// NewV1NetworksNetworkInterfacesPostParams creates a new V1NetworksNetworkInterfacesPostParams 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 NewV1NetworksNetworkInterfacesPostParams() *V1NetworksNetworkInterfacesPostParams { + return &V1NetworksNetworkInterfacesPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworksNetworkInterfacesPostParamsWithTimeout creates a new V1NetworksNetworkInterfacesPostParams object +// with the ability to set a timeout on a request. +func NewV1NetworksNetworkInterfacesPostParamsWithTimeout(timeout time.Duration) *V1NetworksNetworkInterfacesPostParams { + return &V1NetworksNetworkInterfacesPostParams{ + timeout: timeout, + } +} + +// NewV1NetworksNetworkInterfacesPostParamsWithContext creates a new V1NetworksNetworkInterfacesPostParams object +// with the ability to set a context for a request. +func NewV1NetworksNetworkInterfacesPostParamsWithContext(ctx context.Context) *V1NetworksNetworkInterfacesPostParams { + return &V1NetworksNetworkInterfacesPostParams{ + Context: ctx, + } +} + +// NewV1NetworksNetworkInterfacesPostParamsWithHTTPClient creates a new V1NetworksNetworkInterfacesPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworksNetworkInterfacesPostParamsWithHTTPClient(client *http.Client) *V1NetworksNetworkInterfacesPostParams { + return &V1NetworksNetworkInterfacesPostParams{ + HTTPClient: client, + } +} + +/* +V1NetworksNetworkInterfacesPostParams contains all the parameters to send to the API endpoint + + for the v1 networks network interfaces post operation. + + Typically these are written to a http.Request. +*/ +type V1NetworksNetworkInterfacesPostParams struct { + + /* Body. + + Create a Network Interface + */ + Body *models.NetworkInterfaceCreate + + /* NetworkID. + + Network ID + */ + NetworkID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 networks network interfaces post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworksNetworkInterfacesPostParams) WithDefaults() *V1NetworksNetworkInterfacesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 networks network interfaces post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworksNetworkInterfacesPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 networks network interfaces post params +func (o *V1NetworksNetworkInterfacesPostParams) WithTimeout(timeout time.Duration) *V1NetworksNetworkInterfacesPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 networks network interfaces post params +func (o *V1NetworksNetworkInterfacesPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 networks network interfaces post params +func (o *V1NetworksNetworkInterfacesPostParams) WithContext(ctx context.Context) *V1NetworksNetworkInterfacesPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 networks network interfaces post params +func (o *V1NetworksNetworkInterfacesPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 networks network interfaces post params +func (o *V1NetworksNetworkInterfacesPostParams) WithHTTPClient(client *http.Client) *V1NetworksNetworkInterfacesPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 networks network interfaces post params +func (o *V1NetworksNetworkInterfacesPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 networks network interfaces post params +func (o *V1NetworksNetworkInterfacesPostParams) WithBody(body *models.NetworkInterfaceCreate) *V1NetworksNetworkInterfacesPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 networks network interfaces post params +func (o *V1NetworksNetworkInterfacesPostParams) SetBody(body *models.NetworkInterfaceCreate) { + o.Body = body +} + +// WithNetworkID adds the networkID to the v1 networks network interfaces post params +func (o *V1NetworksNetworkInterfacesPostParams) WithNetworkID(networkID string) *V1NetworksNetworkInterfacesPostParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the v1 networks network interfaces post params +func (o *V1NetworksNetworkInterfacesPostParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworksNetworkInterfacesPostParams) 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 network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/networks/v1_networks_network_interfaces_post_responses.go b/power/client/networks/v1_networks_network_interfaces_post_responses.go new file mode 100644 index 00000000..c071669c --- /dev/null +++ b/power/client/networks/v1_networks_network_interfaces_post_responses.go @@ -0,0 +1,638 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworksNetworkInterfacesPostReader is a Reader for the V1NetworksNetworkInterfacesPost structure. +type V1NetworksNetworkInterfacesPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworksNetworkInterfacesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 201: + result := NewV1NetworksNetworkInterfacesPostCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworksNetworkInterfacesPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworksNetworkInterfacesPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworksNetworkInterfacesPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworksNetworkInterfacesPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworksNetworkInterfacesPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewV1NetworksNetworkInterfacesPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworksNetworkInterfacesPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /v1/networks/{network_id}/network-interfaces] v1.networks.network-interfaces.post", response, response.Code()) + } +} + +// NewV1NetworksNetworkInterfacesPostCreated creates a V1NetworksNetworkInterfacesPostCreated with default headers values +func NewV1NetworksNetworkInterfacesPostCreated() *V1NetworksNetworkInterfacesPostCreated { + return &V1NetworksNetworkInterfacesPostCreated{} +} + +/* +V1NetworksNetworkInterfacesPostCreated describes a response with status code 201, with default header values. + +Created +*/ +type V1NetworksNetworkInterfacesPostCreated struct { + Payload *models.NetworkInterface +} + +// IsSuccess returns true when this v1 networks network interfaces post created response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPostCreated) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 networks network interfaces post created response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPostCreated) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces post created response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPostCreated) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 networks network interfaces post created response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPostCreated) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces post created response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPostCreated) IsCode(code int) bool { + return code == 201 +} + +// Code gets the status code for the v1 networks network interfaces post created response +func (o *V1NetworksNetworkInterfacesPostCreated) Code() int { + return 201 +} + +func (o *V1NetworksNetworkInterfacesPostCreated) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostCreated %s", 201, payload) +} + +func (o *V1NetworksNetworkInterfacesPostCreated) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostCreated %s", 201, payload) +} + +func (o *V1NetworksNetworkInterfacesPostCreated) GetPayload() *models.NetworkInterface { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkInterface) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesPostBadRequest creates a V1NetworksNetworkInterfacesPostBadRequest with default headers values +func NewV1NetworksNetworkInterfacesPostBadRequest() *V1NetworksNetworkInterfacesPostBadRequest { + return &V1NetworksNetworkInterfacesPostBadRequest{} +} + +/* +V1NetworksNetworkInterfacesPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworksNetworkInterfacesPostBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces post bad request response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces post bad request response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces post bad request response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces post bad request response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces post bad request response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 networks network interfaces post bad request response +func (o *V1NetworksNetworkInterfacesPostBadRequest) Code() int { + return 400 +} + +func (o *V1NetworksNetworkInterfacesPostBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostBadRequest %s", 400, payload) +} + +func (o *V1NetworksNetworkInterfacesPostBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostBadRequest %s", 400, payload) +} + +func (o *V1NetworksNetworkInterfacesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPostBadRequest) 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 +} + +// NewV1NetworksNetworkInterfacesPostUnauthorized creates a V1NetworksNetworkInterfacesPostUnauthorized with default headers values +func NewV1NetworksNetworkInterfacesPostUnauthorized() *V1NetworksNetworkInterfacesPostUnauthorized { + return &V1NetworksNetworkInterfacesPostUnauthorized{} +} + +/* +V1NetworksNetworkInterfacesPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworksNetworkInterfacesPostUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces post unauthorized response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces post unauthorized response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces post unauthorized response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces post unauthorized response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces post unauthorized response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 networks network interfaces post unauthorized response +func (o *V1NetworksNetworkInterfacesPostUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworksNetworkInterfacesPostUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworksNetworkInterfacesPostUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworksNetworkInterfacesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPostUnauthorized) 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 +} + +// NewV1NetworksNetworkInterfacesPostForbidden creates a V1NetworksNetworkInterfacesPostForbidden with default headers values +func NewV1NetworksNetworkInterfacesPostForbidden() *V1NetworksNetworkInterfacesPostForbidden { + return &V1NetworksNetworkInterfacesPostForbidden{} +} + +/* +V1NetworksNetworkInterfacesPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworksNetworkInterfacesPostForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces post forbidden response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces post forbidden response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces post forbidden response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces post forbidden response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces post forbidden response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 networks network interfaces post forbidden response +func (o *V1NetworksNetworkInterfacesPostForbidden) Code() int { + return 403 +} + +func (o *V1NetworksNetworkInterfacesPostForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostForbidden %s", 403, payload) +} + +func (o *V1NetworksNetworkInterfacesPostForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostForbidden %s", 403, payload) +} + +func (o *V1NetworksNetworkInterfacesPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPostForbidden) 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 +} + +// NewV1NetworksNetworkInterfacesPostNotFound creates a V1NetworksNetworkInterfacesPostNotFound with default headers values +func NewV1NetworksNetworkInterfacesPostNotFound() *V1NetworksNetworkInterfacesPostNotFound { + return &V1NetworksNetworkInterfacesPostNotFound{} +} + +/* +V1NetworksNetworkInterfacesPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworksNetworkInterfacesPostNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces post not found response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces post not found response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces post not found response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces post not found response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces post not found response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 networks network interfaces post not found response +func (o *V1NetworksNetworkInterfacesPostNotFound) Code() int { + return 404 +} + +func (o *V1NetworksNetworkInterfacesPostNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostNotFound %s", 404, payload) +} + +func (o *V1NetworksNetworkInterfacesPostNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostNotFound %s", 404, payload) +} + +func (o *V1NetworksNetworkInterfacesPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPostNotFound) 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 +} + +// NewV1NetworksNetworkInterfacesPostConflict creates a V1NetworksNetworkInterfacesPostConflict with default headers values +func NewV1NetworksNetworkInterfacesPostConflict() *V1NetworksNetworkInterfacesPostConflict { + return &V1NetworksNetworkInterfacesPostConflict{} +} + +/* +V1NetworksNetworkInterfacesPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworksNetworkInterfacesPostConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces post conflict response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces post conflict response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces post conflict response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces post conflict response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces post conflict response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 networks network interfaces post conflict response +func (o *V1NetworksNetworkInterfacesPostConflict) Code() int { + return 409 +} + +func (o *V1NetworksNetworkInterfacesPostConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostConflict %s", 409, payload) +} + +func (o *V1NetworksNetworkInterfacesPostConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostConflict %s", 409, payload) +} + +func (o *V1NetworksNetworkInterfacesPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPostConflict) 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 +} + +// NewV1NetworksNetworkInterfacesPostUnprocessableEntity creates a V1NetworksNetworkInterfacesPostUnprocessableEntity with default headers values +func NewV1NetworksNetworkInterfacesPostUnprocessableEntity() *V1NetworksNetworkInterfacesPostUnprocessableEntity { + return &V1NetworksNetworkInterfacesPostUnprocessableEntity{} +} + +/* +V1NetworksNetworkInterfacesPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type V1NetworksNetworkInterfacesPostUnprocessableEntity struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces post unprocessable entity response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces post unprocessable entity response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces post unprocessable entity response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces post unprocessable entity response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces post unprocessable entity response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the v1 networks network interfaces post unprocessable entity response +func (o *V1NetworksNetworkInterfacesPostUnprocessableEntity) Code() int { + return 422 +} + +func (o *V1NetworksNetworkInterfacesPostUnprocessableEntity) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworksNetworkInterfacesPostUnprocessableEntity) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworksNetworkInterfacesPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPostUnprocessableEntity) 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 +} + +// NewV1NetworksNetworkInterfacesPostInternalServerError creates a V1NetworksNetworkInterfacesPostInternalServerError with default headers values +func NewV1NetworksNetworkInterfacesPostInternalServerError() *V1NetworksNetworkInterfacesPostInternalServerError { + return &V1NetworksNetworkInterfacesPostInternalServerError{} +} + +/* +V1NetworksNetworkInterfacesPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworksNetworkInterfacesPostInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces post internal server error response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces post internal server error response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces post internal server error response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 networks network interfaces post internal server error response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 networks network interfaces post internal server error response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 networks network interfaces post internal server error response +func (o *V1NetworksNetworkInterfacesPostInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworksNetworkInterfacesPostInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworksNetworkInterfacesPostInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworksNetworkInterfacesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPostInternalServerError) 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/networks/v1_networks_network_interfaces_put_parameters.go b/power/client/networks/v1_networks_network_interfaces_put_parameters.go new file mode 100644 index 00000000..77e8d3d2 --- /dev/null +++ b/power/client/networks/v1_networks_network_interfaces_put_parameters.go @@ -0,0 +1,197 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// 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" +) + +// NewV1NetworksNetworkInterfacesPutParams creates a new V1NetworksNetworkInterfacesPutParams 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 NewV1NetworksNetworkInterfacesPutParams() *V1NetworksNetworkInterfacesPutParams { + return &V1NetworksNetworkInterfacesPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworksNetworkInterfacesPutParamsWithTimeout creates a new V1NetworksNetworkInterfacesPutParams object +// with the ability to set a timeout on a request. +func NewV1NetworksNetworkInterfacesPutParamsWithTimeout(timeout time.Duration) *V1NetworksNetworkInterfacesPutParams { + return &V1NetworksNetworkInterfacesPutParams{ + timeout: timeout, + } +} + +// NewV1NetworksNetworkInterfacesPutParamsWithContext creates a new V1NetworksNetworkInterfacesPutParams object +// with the ability to set a context for a request. +func NewV1NetworksNetworkInterfacesPutParamsWithContext(ctx context.Context) *V1NetworksNetworkInterfacesPutParams { + return &V1NetworksNetworkInterfacesPutParams{ + Context: ctx, + } +} + +// NewV1NetworksNetworkInterfacesPutParamsWithHTTPClient creates a new V1NetworksNetworkInterfacesPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworksNetworkInterfacesPutParamsWithHTTPClient(client *http.Client) *V1NetworksNetworkInterfacesPutParams { + return &V1NetworksNetworkInterfacesPutParams{ + HTTPClient: client, + } +} + +/* +V1NetworksNetworkInterfacesPutParams contains all the parameters to send to the API endpoint + + for the v1 networks network interfaces put operation. + + Typically these are written to a http.Request. +*/ +type V1NetworksNetworkInterfacesPutParams struct { + + /* Body. + + Parameters for updating a Network Interface + */ + Body *models.NetworkInterfaceUpdate + + /* NetworkID. + + Network ID + */ + NetworkID string + + /* NetworkInterfaceID. + + Network Interface ID + */ + NetworkInterfaceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 networks network interfaces put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworksNetworkInterfacesPutParams) WithDefaults() *V1NetworksNetworkInterfacesPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 networks network interfaces put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworksNetworkInterfacesPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) WithTimeout(timeout time.Duration) *V1NetworksNetworkInterfacesPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) WithContext(ctx context.Context) *V1NetworksNetworkInterfacesPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) WithHTTPClient(client *http.Client) *V1NetworksNetworkInterfacesPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) WithBody(body *models.NetworkInterfaceUpdate) *V1NetworksNetworkInterfacesPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) SetBody(body *models.NetworkInterfaceUpdate) { + o.Body = body +} + +// WithNetworkID adds the networkID to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) WithNetworkID(networkID string) *V1NetworksNetworkInterfacesPutParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WithNetworkInterfaceID adds the networkInterfaceID to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) WithNetworkInterfaceID(networkInterfaceID string) *V1NetworksNetworkInterfacesPutParams { + o.SetNetworkInterfaceID(networkInterfaceID) + return o +} + +// SetNetworkInterfaceID adds the networkInterfaceId to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) SetNetworkInterfaceID(networkInterfaceID string) { + o.NetworkInterfaceID = networkInterfaceID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworksNetworkInterfacesPutParams) 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 network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + // path param network_interface_id + if err := r.SetPathParam("network_interface_id", o.NetworkInterfaceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/networks/v1_networks_network_interfaces_put_responses.go b/power/client/networks/v1_networks_network_interfaces_put_responses.go new file mode 100644 index 00000000..81898478 --- /dev/null +++ b/power/client/networks/v1_networks_network_interfaces_put_responses.go @@ -0,0 +1,562 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworksNetworkInterfacesPutReader is a Reader for the V1NetworksNetworkInterfacesPut structure. +type V1NetworksNetworkInterfacesPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworksNetworkInterfacesPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworksNetworkInterfacesPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworksNetworkInterfacesPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworksNetworkInterfacesPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworksNetworkInterfacesPutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworksNetworkInterfacesPutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewV1NetworksNetworkInterfacesPutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworksNetworkInterfacesPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}] v1.networks.network-interfaces.put", response, response.Code()) + } +} + +// NewV1NetworksNetworkInterfacesPutOK creates a V1NetworksNetworkInterfacesPutOK with default headers values +func NewV1NetworksNetworkInterfacesPutOK() *V1NetworksNetworkInterfacesPutOK { + return &V1NetworksNetworkInterfacesPutOK{} +} + +/* +V1NetworksNetworkInterfacesPutOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworksNetworkInterfacesPutOK struct { + Payload *models.NetworkInterface +} + +// IsSuccess returns true when this v1 networks network interfaces put o k response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPutOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 networks network interfaces put o k response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPutOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces put o k response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPutOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 networks network interfaces put o k response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPutOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces put o k response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPutOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 networks network interfaces put o k response +func (o *V1NetworksNetworkInterfacesPutOK) Code() int { + return 200 +} + +func (o *V1NetworksNetworkInterfacesPutOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutOK %s", 200, payload) +} + +func (o *V1NetworksNetworkInterfacesPutOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutOK %s", 200, payload) +} + +func (o *V1NetworksNetworkInterfacesPutOK) GetPayload() *models.NetworkInterface { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkInterface) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesPutBadRequest creates a V1NetworksNetworkInterfacesPutBadRequest with default headers values +func NewV1NetworksNetworkInterfacesPutBadRequest() *V1NetworksNetworkInterfacesPutBadRequest { + return &V1NetworksNetworkInterfacesPutBadRequest{} +} + +/* +V1NetworksNetworkInterfacesPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworksNetworkInterfacesPutBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces put bad request response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPutBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces put bad request response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPutBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces put bad request response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPutBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces put bad request response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPutBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces put bad request response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPutBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 networks network interfaces put bad request response +func (o *V1NetworksNetworkInterfacesPutBadRequest) Code() int { + return 400 +} + +func (o *V1NetworksNetworkInterfacesPutBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutBadRequest %s", 400, payload) +} + +func (o *V1NetworksNetworkInterfacesPutBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutBadRequest %s", 400, payload) +} + +func (o *V1NetworksNetworkInterfacesPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPutBadRequest) 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 +} + +// NewV1NetworksNetworkInterfacesPutUnauthorized creates a V1NetworksNetworkInterfacesPutUnauthorized with default headers values +func NewV1NetworksNetworkInterfacesPutUnauthorized() *V1NetworksNetworkInterfacesPutUnauthorized { + return &V1NetworksNetworkInterfacesPutUnauthorized{} +} + +/* +V1NetworksNetworkInterfacesPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworksNetworkInterfacesPutUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces put unauthorized response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPutUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces put unauthorized response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPutUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces put unauthorized response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPutUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces put unauthorized response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPutUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces put unauthorized response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPutUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 networks network interfaces put unauthorized response +func (o *V1NetworksNetworkInterfacesPutUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworksNetworkInterfacesPutUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutUnauthorized %s", 401, payload) +} + +func (o *V1NetworksNetworkInterfacesPutUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutUnauthorized %s", 401, payload) +} + +func (o *V1NetworksNetworkInterfacesPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPutUnauthorized) 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 +} + +// NewV1NetworksNetworkInterfacesPutForbidden creates a V1NetworksNetworkInterfacesPutForbidden with default headers values +func NewV1NetworksNetworkInterfacesPutForbidden() *V1NetworksNetworkInterfacesPutForbidden { + return &V1NetworksNetworkInterfacesPutForbidden{} +} + +/* +V1NetworksNetworkInterfacesPutForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworksNetworkInterfacesPutForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces put forbidden response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPutForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces put forbidden response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPutForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces put forbidden response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPutForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces put forbidden response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPutForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces put forbidden response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPutForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 networks network interfaces put forbidden response +func (o *V1NetworksNetworkInterfacesPutForbidden) Code() int { + return 403 +} + +func (o *V1NetworksNetworkInterfacesPutForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutForbidden %s", 403, payload) +} + +func (o *V1NetworksNetworkInterfacesPutForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutForbidden %s", 403, payload) +} + +func (o *V1NetworksNetworkInterfacesPutForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPutForbidden) 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 +} + +// NewV1NetworksNetworkInterfacesPutNotFound creates a V1NetworksNetworkInterfacesPutNotFound with default headers values +func NewV1NetworksNetworkInterfacesPutNotFound() *V1NetworksNetworkInterfacesPutNotFound { + return &V1NetworksNetworkInterfacesPutNotFound{} +} + +/* +V1NetworksNetworkInterfacesPutNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworksNetworkInterfacesPutNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces put not found response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPutNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces put not found response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPutNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces put not found response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPutNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces put not found response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPutNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces put not found response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPutNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 networks network interfaces put not found response +func (o *V1NetworksNetworkInterfacesPutNotFound) Code() int { + return 404 +} + +func (o *V1NetworksNetworkInterfacesPutNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutNotFound %s", 404, payload) +} + +func (o *V1NetworksNetworkInterfacesPutNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutNotFound %s", 404, payload) +} + +func (o *V1NetworksNetworkInterfacesPutNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPutNotFound) 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 +} + +// NewV1NetworksNetworkInterfacesPutUnprocessableEntity creates a V1NetworksNetworkInterfacesPutUnprocessableEntity with default headers values +func NewV1NetworksNetworkInterfacesPutUnprocessableEntity() *V1NetworksNetworkInterfacesPutUnprocessableEntity { + return &V1NetworksNetworkInterfacesPutUnprocessableEntity{} +} + +/* +V1NetworksNetworkInterfacesPutUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type V1NetworksNetworkInterfacesPutUnprocessableEntity struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces put unprocessable entity response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPutUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces put unprocessable entity response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPutUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces put unprocessable entity response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPutUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces put unprocessable entity response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPutUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces put unprocessable entity response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPutUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the v1 networks network interfaces put unprocessable entity response +func (o *V1NetworksNetworkInterfacesPutUnprocessableEntity) Code() int { + return 422 +} + +func (o *V1NetworksNetworkInterfacesPutUnprocessableEntity) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworksNetworkInterfacesPutUnprocessableEntity) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworksNetworkInterfacesPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPutUnprocessableEntity) 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 +} + +// NewV1NetworksNetworkInterfacesPutInternalServerError creates a V1NetworksNetworkInterfacesPutInternalServerError with default headers values +func NewV1NetworksNetworkInterfacesPutInternalServerError() *V1NetworksNetworkInterfacesPutInternalServerError { + return &V1NetworksNetworkInterfacesPutInternalServerError{} +} + +/* +V1NetworksNetworkInterfacesPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworksNetworkInterfacesPutInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces put internal server error response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPutInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces put internal server error response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPutInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces put internal server error response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPutInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 networks network interfaces put internal server error response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPutInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 networks network interfaces put internal server error response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPutInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 networks network interfaces put internal server error response +func (o *V1NetworksNetworkInterfacesPutInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworksNetworkInterfacesPutInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutInternalServerError %s", 500, payload) +} + +func (o *V1NetworksNetworkInterfacesPutInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutInternalServerError %s", 500, payload) +} + +func (o *V1NetworksNetworkInterfacesPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPutInternalServerError) 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 43c7c298..3c14cb10 100644 --- a/power/client/power_iaas_api_client.go +++ b/power/client/power_iaas_api_client.go @@ -21,6 +21,7 @@ import ( "github.com/IBM-Cloud/power-go-client/power/client/internal_power_v_s_locations" "github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions" "github.com/IBM-Cloud/power-go-client/power/client/internal_transit_gateway" + "github.com/IBM-Cloud/power-go-client/power/client/networks" "github.com/IBM-Cloud/power-go-client/power/client/open_stacks" "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections" "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_disaster_recovery" @@ -110,6 +111,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *PowerIaasA cli.InternalPowervsLocations = internal_power_v_s_locations.New(transport, formats) cli.InternalStorageRegions = internal_storage_regions.New(transport, formats) cli.InternalTransitGateway = internal_transit_gateway.New(transport, formats) + cli.Networks = networks.New(transport, formats) cli.OpenStacks = open_stacks.New(transport, formats) cli.PCloudCloudConnections = p_cloud_cloud_connections.New(transport, formats) cli.PCloudDisasterRecovery = p_cloud_disaster_recovery.New(transport, formats) @@ -210,6 +212,8 @@ type PowerIaasAPI struct { InternalTransitGateway internal_transit_gateway.ClientService + Networks networks.ClientService + OpenStacks open_stacks.ClientService PCloudCloudConnections p_cloud_cloud_connections.ClientService @@ -295,6 +299,7 @@ func (c *PowerIaasAPI) SetTransport(transport runtime.ClientTransport) { c.InternalPowervsLocations.SetTransport(transport) c.InternalStorageRegions.SetTransport(transport) c.InternalTransitGateway.SetTransport(transport) + c.Networks.SetTransport(transport) c.OpenStacks.SetTransport(transport) c.PCloudCloudConnections.SetTransport(transport) c.PCloudDisasterRecovery.SetTransport(transport) diff --git a/power/models/network_interface.go b/power/models/network_interface.go new file mode 100644 index 00000000..4c4792b9 --- /dev/null +++ b/power/models/network_interface.go @@ -0,0 +1,258 @@ +// 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" +) + +// NetworkInterface network interface +// +// swagger:model NetworkInterface +type NetworkInterface struct { + + // The Network Interface's crn + // Required: true + Crn *string `json:"crn"` + + // The unique Network Interface ID + // Required: true + ID *string `json:"id"` + + // instance + Instance *NetworkInterfaceInstance `json:"instance,omitempty"` + + // The ip address of this Network Interface + // Required: true + IPAddress *string `json:"ipAddress"` + + // The mac address of the Network Interface + // Required: true + MacAddress *string `json:"macAddress"` + + // Name of the Network Interface (not unique or indexable) + // Required: true + Name *string `json:"name"` + + // ID of the Network Security Group the network interface will be added to + NetworkSecurityGroupID string `json:"networkSecurityGroupID,omitempty"` + + // The status of the network address group + // Required: true + Status *string `json:"status"` + + // The user tags associated with this resource. + UserTags []string `json:"userTags,omitempty"` +} + +// Validate validates this network interface +func (m *NetworkInterface) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateInstance(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIPAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMacAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkInterface) validateCrn(formats strfmt.Registry) error { + + if err := validate.Required("crn", "body", m.Crn); err != nil { + return err + } + + return nil +} + +func (m *NetworkInterface) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *NetworkInterface) validateInstance(formats strfmt.Registry) error { + if swag.IsZero(m.Instance) { // not required + return nil + } + + if m.Instance != nil { + if err := m.Instance.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("instance") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("instance") + } + return err + } + } + + return nil +} + +func (m *NetworkInterface) validateIPAddress(formats strfmt.Registry) error { + + if err := validate.Required("ipAddress", "body", m.IPAddress); err != nil { + return err + } + + return nil +} + +func (m *NetworkInterface) validateMacAddress(formats strfmt.Registry) error { + + if err := validate.Required("macAddress", "body", m.MacAddress); err != nil { + return err + } + + return nil +} + +func (m *NetworkInterface) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *NetworkInterface) validateStatus(formats strfmt.Registry) error { + + if err := validate.Required("status", "body", m.Status); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this network interface based on the context it is used +func (m *NetworkInterface) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateInstance(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkInterface) contextValidateInstance(ctx context.Context, formats strfmt.Registry) error { + + if m.Instance != nil { + + if swag.IsZero(m.Instance) { // not required + return nil + } + + if err := m.Instance.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("instance") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("instance") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkInterface) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkInterface) UnmarshalBinary(b []byte) error { + var res NetworkInterface + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// NetworkInterfaceInstance The attached instance to this Network Interface +// +// swagger:model NetworkInterfaceInstance +type NetworkInterfaceInstance struct { + + // Link to instance resource + Href string `json:"href,omitempty"` + + // The attached instance ID + InstanceID string `json:"instanceID,omitempty"` +} + +// Validate validates this network interface instance +func (m *NetworkInterfaceInstance) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this network interface instance based on context it is used +func (m *NetworkInterfaceInstance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkInterfaceInstance) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkInterfaceInstance) UnmarshalBinary(b []byte) error { + var res NetworkInterfaceInstance + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_interface_create.go b/power/models/network_interface_create.go new file mode 100644 index 00000000..fab1c643 --- /dev/null +++ b/power/models/network_interface_create.go @@ -0,0 +1,56 @@ +// 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" +) + +// NetworkInterfaceCreate network interface create +// +// swagger:model NetworkInterfaceCreate +type NetworkInterfaceCreate struct { + + // The requested IP address of this Network Interface + IPAddress string `json:"ipAddress,omitempty"` + + // Name of the Network Interface + Name string `json:"name,omitempty"` + + // The user tags associated with this resource. + UserTags []string `json:"userTags"` +} + +// Validate validates this network interface create +func (m *NetworkInterfaceCreate) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this network interface create based on context it is used +func (m *NetworkInterfaceCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkInterfaceCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkInterfaceCreate) UnmarshalBinary(b []byte) error { + var res NetworkInterfaceCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_interface_update.go b/power/models/network_interface_update.go new file mode 100644 index 00000000..c6c981e0 --- /dev/null +++ b/power/models/network_interface_update.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" +) + +// NetworkInterfaceUpdate network interface update +// +// swagger:model NetworkInterfaceUpdate +type NetworkInterfaceUpdate struct { + + // If supplied populated it attaches to the InstanceID, if empty detaches from InstanceID + InstanceID *string `json:"instanceID,omitempty"` + + // Name of the Network Interface + Name *string `json:"name,omitempty"` +} + +// Validate validates this network interface update +func (m *NetworkInterfaceUpdate) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this network interface update based on context it is used +func (m *NetworkInterfaceUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkInterfaceUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkInterfaceUpdate) UnmarshalBinary(b []byte) error { + var res NetworkInterfaceUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_interfaces.go b/power/models/network_interfaces.go new file mode 100644 index 00000000..a9ec76a7 --- /dev/null +++ b/power/models/network_interfaces.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" + "github.com/go-openapi/validate" +) + +// NetworkInterfaces network interfaces +// +// swagger:model NetworkInterfaces +type NetworkInterfaces struct { + + // Network Interfaces + // Required: true + Interfaces []*NetworkInterface `json:"interfaces"` +} + +// Validate validates this network interfaces +func (m *NetworkInterfaces) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateInterfaces(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkInterfaces) validateInterfaces(formats strfmt.Registry) error { + + if err := validate.Required("interfaces", "body", m.Interfaces); err != nil { + return err + } + + for i := 0; i < len(m.Interfaces); i++ { + if swag.IsZero(m.Interfaces[i]) { // not required + continue + } + + if m.Interfaces[i] != nil { + if err := m.Interfaces[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("interfaces" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("interfaces" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this network interfaces based on the context it is used +func (m *NetworkInterfaces) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateInterfaces(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkInterfaces) contextValidateInterfaces(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Interfaces); i++ { + + if m.Interfaces[i] != nil { + + if swag.IsZero(m.Interfaces[i]) { // not required + return nil + } + + if err := m.Interfaces[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("interfaces" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("interfaces" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkInterfaces) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkInterfaces) UnmarshalBinary(b []byte) error { + var res NetworkInterfaces + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +}