diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d8f5e267..24eac552 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -14,7 +14,6 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Go uses: actions/setup-go@v5 with: diff --git a/clients/instance/ibm-pi-datacenters.go b/clients/instance/ibm-pi-datacenters.go index afc90ebc..a4d8c4ff 100644 --- a/clients/instance/ibm-pi-datacenters.go +++ b/clients/instance/ibm-pi-datacenters.go @@ -23,26 +23,53 @@ func NewIBMPIDatacenterClient(ctx context.Context, sess *ibmpisession.IBMPISessi } } func (f *IBMPIDatacentersClient) Get(datacenterRegion string) (*models.Datacenter, error) { - params := datacenters.NewV1DatacentersGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithDatacenterRegion(datacenterRegion) - resp, err := f.session.Power.Datacenters.V1DatacentersGet(params) - if err != nil { - return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf(errors.GetDatacenterOperationFailed, f.cloudInstanceID, err)) - } - if resp == nil || resp.Payload == nil { - return nil, fmt.Errorf("failed to Get Datacenter %s", datacenterRegion) + if !f.session.IsOnPrem() { + params := datacenters.NewV1DatacentersGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithDatacenterRegion(datacenterRegion) + resp, err := f.session.Power.Datacenters.V1DatacentersGet(params) + + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf(errors.GetDatacenterOperationFailed, f.cloudInstanceID, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get Datacenter %s", datacenterRegion) + } + return resp.Payload, nil + } else { + params := datacenters.NewV1DatacentersPrivateGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithDatacenterRegion(datacenterRegion) + resp, err := f.session.Power.Datacenters.V1DatacentersPrivateGet(params, f.session.AuthInfo(f.cloudInstanceID)) + + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf(errors.GetDatacenterOperationFailed, f.cloudInstanceID, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get Private Datacenter %s", datacenterRegion) + } + return resp.Payload, nil } - return resp.Payload, nil } func (f *IBMPIDatacentersClient) GetAll() (*models.Datacenters, error) { - params := datacenters.NewV1DatacentersGetallParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut) - resp, err := f.session.Power.Datacenters.V1DatacentersGetall(params) + if !f.session.IsOnPrem() { + params := datacenters.NewV1DatacentersGetallParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut) + resp, err := f.session.Power.Datacenters.V1DatacentersGetall(params) - if err != nil { - return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get all Datacenters: %w", err)) - } - if resp == nil || resp.Payload == nil { - return nil, fmt.Errorf("failed to Get all Datacenters") + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get all Datacenters: %w", err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get all Datacenters") + } + return resp.Payload, nil + } else { + params := datacenters.NewV1DatacentersPrivateGetallParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut) + resp, err := f.session.Power.Datacenters.V1DatacentersPrivateGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get all Datacenters: %w", err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get all private Datacenters") + } + return resp.Payload, nil } - return resp.Payload, nil } diff --git a/clients/instance/ibm-pi-dr-location.go b/clients/instance/ibm-pi-dr-location.go index 8c7b0d41..7e95ba79 100644 --- a/clients/instance/ibm-pi-dr-location.go +++ b/clients/instance/ibm-pi-dr-location.go @@ -25,9 +25,6 @@ func NewIBMPIDisasterRecoveryLocationClient(ctx context.Context, sess *ibmpisess // Get the disaster recovery site details for the current location func (f *IBMPIDisasterRecoveryLocationClient) Get() (*models.DisasterRecoveryLocation, error) { - if f.session.IsOnPrem() { - return nil, fmt.Errorf("operation not supported in satellite location, check documentation") - } params := p_cloud_disaster_recovery.NewPcloudLocationsDisasterrecoveryGetParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID) @@ -43,9 +40,6 @@ func (f *IBMPIDisasterRecoveryLocationClient) Get() (*models.DisasterRecoveryLoc // Get all disaster recovery locations supported by Power Virtual Server func (f *IBMPIDisasterRecoveryLocationClient) GetAll() (*models.DisasterRecoveryLocations, error) { - if f.session.IsOnPrem() { - return nil, fmt.Errorf("operation not supported in satellite location, check documentation") - } params := p_cloud_disaster_recovery.NewPcloudLocationsDisasterrecoveryGetallParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut) resp, err := f.session.Power.PCloudDisasterRecovery.PcloudLocationsDisasterrecoveryGetall(params, f.session.AuthInfo(f.cloudInstanceID)) diff --git a/clients/instance/ibm-pi-host-groups.go b/clients/instance/ibm-pi-host-groups.go index 4c6c2474..0fb69f27 100644 --- a/clients/instance/ibm-pi-host-groups.go +++ b/clients/instance/ibm-pi-host-groups.go @@ -112,7 +112,9 @@ func (f *IBMPIHostGroupsClient) GetHosts() (models.HostList, error) { if f.session.IsOnPrem() { return nil, fmt.Errorf("operation not supported in satellite location, check documentation") } + hostReference := true params := host_groups.NewV1HostsGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut) + params.HostReference = &hostReference resp, err := f.session.Power.HostGroups.V1HostsGet(params, f.session.AuthInfo(f.cloudInstanceID)) if err != nil { return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to get hosts for %s: %w", f.cloudInstanceID, err)) @@ -146,7 +148,9 @@ func (f *IBMPIHostGroupsClient) GetHost(id string) (*models.Host, error) { if f.session.IsOnPrem() { return nil, fmt.Errorf("operation not supported in satellite location, check documentation") } + hostReference := true params := host_groups.NewV1HostsIDGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithHostID(id) + params.HostReference = &hostReference resp, err := f.session.Power.HostGroups.V1HostsIDGet(params, f.session.AuthInfo(f.cloudInstanceID)) if err != nil { return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to get host %s for %s: %w", id, f.cloudInstanceID, err)) diff --git a/clients/instance/ibm-pi-instance.go b/clients/instance/ibm-pi-instance.go index f676a5b9..4d51878e 100644 --- a/clients/instance/ibm-pi-instance.go +++ b/clients/instance/ibm-pi-instance.go @@ -55,8 +55,8 @@ func (f *IBMPIInstanceClient) GetAll() (*models.PVMInstances, error) { // Create an Instance func (f *IBMPIInstanceClient) Create(body *models.PVMInstanceCreate) (*models.PVMInstanceList, error) { // Check for satellite differences in this endpoint - if f.session.IsOnPrem() && body.DeploymentTarget != nil { - return nil, fmt.Errorf("deployment target parameter is not supported in satellite location, check documentation") + if f.session.IsOnPrem() && (body.DeploymentTarget != nil || body.DeploymentType != "") { + return nil, fmt.Errorf("deployment target and deployment type parameters are not supported in satellite location, check documentation") } params := p_cloud_p_vm_instances.NewPcloudPvminstancesPostParams(). WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). @@ -89,6 +89,18 @@ func (f *IBMPIInstanceClient) Delete(id string) error { return nil } +// Delete an Instance with body +func (f *IBMPIInstanceClient) DeleteWithBody(id string, body *models.PVMInstanceDelete) error { + params := p_cloud_p_vm_instances.NewPcloudPvminstancesDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id).WithBody(body) + _, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf("failed to Delete PVM Instance %s :%w", id, err) + } + return nil +} + // Update an Instance func (f *IBMPIInstanceClient) Update(id string, body *models.PVMInstanceUpdate) (*models.PVMInstanceUpdateResponse, error) { // Check for satellite differences in this endpoint diff --git a/clients/instance/ibm-pi-network-peers.go b/clients/instance/ibm-pi-network-peers.go new file mode 100644 index 00000000..a1f47dea --- /dev/null +++ b/clients/instance/ibm-pi-network-peers.go @@ -0,0 +1,40 @@ +package instance + +import ( + "context" + "fmt" + + "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/network_peers" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPINetworkPeerClient +type IBMPINetworkPeerClient struct { + IBMPIClient +} + +// NewIBMPINetworkPeerClient +func NewIBMPINetworkPeerClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPINetworkPeerClient { + return &IBMPINetworkPeerClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// Get network peers +func (f *IBMPINetworkPeerClient) GetNetworkPeers() (*models.NetworkPeers, error) { + if !f.session.IsOnPrem() { + return nil, fmt.Errorf("not supported in off-prem location") + } + params := network_peers.NewV1NetworkPeersListParams().WithContext(f.ctx). + WithTimeout(helpers.PIGetTimeOut) + resp, err := f.session.Power.NetworkPeers.V1NetworkPeersList(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get Network Peers for cloud instance %s with error %w", f.cloudInstanceID, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get Network Peers for cloud instance %s", f.cloudInstanceID) + } + return resp.Payload, nil +} diff --git a/clients/instance/ibm-pi-spp-placement-groups.go b/clients/instance/ibm-pi-spp-placement-groups.go index a628bca6..8060dcac 100644 --- a/clients/instance/ibm-pi-spp-placement-groups.go +++ b/clients/instance/ibm-pi-spp-placement-groups.go @@ -26,9 +26,6 @@ func NewIBMPISPPPlacementGroupClient(ctx context.Context, sess *ibmpisession.IBM // Get a PI SPP Placement Group func (f *IBMPISPPPlacementGroupClient) Get(id string) (*models.SPPPlacementGroup, error) { - if f.session.IsOnPrem() { - return nil, fmt.Errorf("operation not supported in satellite location, check documentation") - } params := p_cloud_s_p_p_placement_groups.NewPcloudSppplacementgroupsGetParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithSppPlacementGroupID(id) @@ -44,9 +41,6 @@ func (f *IBMPISPPPlacementGroupClient) Get(id string) (*models.SPPPlacementGroup // Get All SPP Placement Groups func (f *IBMPISPPPlacementGroupClient) GetAll() (*models.SPPPlacementGroups, error) { - if f.session.IsOnPrem() { - return nil, fmt.Errorf("operation not supported in satellite location, check documentation") - } params := p_cloud_s_p_p_placement_groups.NewPcloudSppplacementgroupsGetallParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID) @@ -62,9 +56,6 @@ func (f *IBMPISPPPlacementGroupClient) GetAll() (*models.SPPPlacementGroups, err // Create a SPP Placement Group func (f *IBMPISPPPlacementGroupClient) Create(body *models.SPPPlacementGroupCreate) (*models.SPPPlacementGroup, error) { - if f.session.IsOnPrem() { - return nil, fmt.Errorf("operation not supported in satellite location, check documentation") - } params := p_cloud_s_p_p_placement_groups.NewPcloudSppplacementgroupsPostParams(). WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithBody(body) @@ -80,9 +71,6 @@ func (f *IBMPISPPPlacementGroupClient) Create(body *models.SPPPlacementGroupCrea // Delete a SPP Placement Group func (f *IBMPISPPPlacementGroupClient) Delete(id string) error { - if f.session.IsOnPrem() { - return fmt.Errorf("operation not supported in satellite location, check documentation") - } params := p_cloud_s_p_p_placement_groups.NewPcloudSppplacementgroupsDeleteParams(). WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithSppPlacementGroupID(id) @@ -95,9 +83,6 @@ func (f *IBMPISPPPlacementGroupClient) Delete(id string) error { // Add an Instance to a SPP Placement Group func (f *IBMPISPPPlacementGroupClient) AddMember(id string, sppID string) (*models.SPPPlacementGroup, error) { - if f.session.IsOnPrem() { - return nil, fmt.Errorf("operation not supported in satellite location, check documentation") - } params := p_cloud_s_p_p_placement_groups.NewPcloudSppplacementgroupsMembersPostParams(). WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithSppPlacementGroupID(id). @@ -114,9 +99,6 @@ func (f *IBMPISPPPlacementGroupClient) AddMember(id string, sppID string) (*mode // Remove an Instance to a SPP Placement Group func (f *IBMPISPPPlacementGroupClient) DeleteMember(id string, sppID string) (*models.SPPPlacementGroup, error) { - if f.session.IsOnPrem() { - return nil, fmt.Errorf("operation not supported in satellite location, check documentation") - } params := p_cloud_s_p_p_placement_groups.NewPcloudSppplacementgroupsMembersDeleteParams(). WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithSppPlacementGroupID(id). diff --git a/clients/instance/ibm-pi-virtual-serial-number.go b/clients/instance/ibm-pi-virtual-serial-number.go new file mode 100644 index 00000000..526d6a84 --- /dev/null +++ b/clients/instance/ibm-pi-virtual-serial-number.go @@ -0,0 +1,124 @@ +package instance + +import ( + "context" + "fmt" + + "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/p_cloud_virtual_serial_number" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPIVSNClient + +type IBMPIVSNClient struct { + IBMPIClient +} + +// NewIBMPIVSNClient +func NewIBMPIVSNClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPIVSNClient { + return &IBMPIVSNClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// Get Virtual Serial Number +func (f *IBMPIVSNClient) Get(id string) (*models.VirtualSerialNumber, error) { + params := p_cloud_virtual_serial_number.NewPcloudVirtualserialnumberGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithVirtualSerialNumber(id) + resp, err := f.session.Power.PCloudVirtualSerialNumber.PcloudVirtualserialnumberGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to get virtual serial number %s :%w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get virtual serial number %s", id) + } + return resp.Payload, nil +} + +// Get All Virtual Serial Numbers +func (f *IBMPIVSNClient) GetAll(pvmInstanceID *string) (models.VirtualSerialNumberList, error) { + params := p_cloud_virtual_serial_number.NewPcloudVirtualserialnumberGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut) + if pvmInstanceID != nil { + params.SetPvmInstanceID(pvmInstanceID) + } + resp, err := f.session.Power.PCloudVirtualSerialNumber.PcloudVirtualserialnumberGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to get all virtual serial numbers in %s :%w", f.cloudInstanceID, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get all virtual serial numbers in %s", f.cloudInstanceID) + } + return resp.Payload, nil +} + +// Update Virtual Serial Nunber +func (f *IBMPIVSNClient) Update(id string, body *models.UpdateVirtualSerialNumber) (*models.GetServerVirtualSerialNumber, error) { + params := p_cloud_virtual_serial_number.NewPcloudVirtualserialnumberPutParams(). + WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut).WithVirtualSerialNumber(id). + WithBody(body) + resp, err := f.session.Power.PCloudVirtualSerialNumber.PcloudVirtualserialnumberPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to update virtual serial number %s :%w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Update virtual serial number %s", id) + } + return resp.Payload, nil +} + +// Delete Virtual Serial Number +func (f *IBMPIVSNClient) Delete(id string) error { + params := p_cloud_virtual_serial_number.NewPcloudVirtualserialnumberDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithVirtualSerialNumber(id) + _, err := f.session.Power.PCloudVirtualSerialNumber.PcloudVirtualserialnumberDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to delete virtual serial number %s :%w", id, err)) + } + return nil +} + +// PVM Instance Delete VSN +func (f *IBMPIVSNClient) PVMInstanceDeleteVSN(pvmInstanceID string, body *models.DeleteServerVirtualSerialNumber) error { + params := p_cloud_virtual_serial_number.NewPcloudPvminstancesVirtualserialnumberDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut).WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(pvmInstanceID). + WithBody(body) + _, err := f.session.Power.PCloudVirtualSerialNumber.PcloudPvminstancesVirtualserialnumberDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to delete virtual serial number for pvm instance %s :%w", pvmInstanceID, err)) + } + return nil +} + +// PVM Instance Update VSN +func (f *IBMPIVSNClient) PVMInstanceUpdateVSN(pvmInstanceID string, body *models.UpdateServerVirtualSerialNumber) (*models.VirtualSerialNumber, error) { + params := p_cloud_virtual_serial_number.NewPcloudPvminstancesVirtualserialnumberPutParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithCloudInstanceID(f.cloudInstanceID). + WithPvmInstanceID(pvmInstanceID).WithBody(body) + resp, err := f.session.Power.PCloudVirtualSerialNumber.PcloudPvminstancesVirtualserialnumberPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to update virtual serial number for pvm instance %s :%w", pvmInstanceID, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to update virtual serial number for pvm instance %s", pvmInstanceID) + } + return resp.Payload, nil +} + +// PVM Attach VSN +func (f *IBMPIVSNClient) PVMInstanceAttachVSN(pvmInstanceID string, body *models.AddServerVirtualSerialNumber) (*models.VirtualSerialNumber, error) { + params := p_cloud_virtual_serial_number.NewPcloudPvminstancesVirtualserialnumberPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithCloudInstanceID(f.cloudInstanceID). + WithPvmInstanceID(pvmInstanceID).WithBody(body) + resp, err := f.session.Power.PCloudVirtualSerialNumber.PcloudPvminstancesVirtualserialnumberPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to attach virtual serial number for pvm instance %s :%w", pvmInstanceID, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to attach virtual serial number for pvm instance %s", pvmInstanceID) + } + return resp.Payload, nil +} diff --git a/clients/instance/ibm-pi-volume-onboarding.go b/clients/instance/ibm-pi-volume-onboarding.go index b41dde16..aaa8a27e 100644 --- a/clients/instance/ibm-pi-volume-onboarding.go +++ b/clients/instance/ibm-pi-volume-onboarding.go @@ -25,9 +25,6 @@ func NewIBMPIVolumeOnboardingClient(ctx context.Context, sess *ibmpisession.IBMP // Get the information of volume onboarding operation func (f *IBMPIVolumeOnboardingClient) Get(id string) (*models.VolumeOnboarding, error) { - if f.session.IsOnPrem() { - return nil, fmt.Errorf("operation not supported in satellite location, check documentation") - } params := p_cloud_volume_onboarding.NewPcloudVolumeOnboardingGetParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithVolumeOnboardingID(id) @@ -43,9 +40,6 @@ func (f *IBMPIVolumeOnboardingClient) Get(id string) (*models.VolumeOnboarding, // Get All volume onboardings for this cloud instance func (f *IBMPIVolumeOnboardingClient) GetAll() (*models.VolumeOnboardings, error) { - if f.session.IsOnPrem() { - return nil, fmt.Errorf("operation not supported in satellite location, check documentation") - } params := p_cloud_volume_onboarding.NewPcloudVolumeOnboardingGetallParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID) @@ -61,9 +55,6 @@ func (f *IBMPIVolumeOnboardingClient) GetAll() (*models.VolumeOnboardings, error // Onboard auxiliary volumes to target site func (f *IBMPIVolumeOnboardingClient) CreateVolumeOnboarding(body *models.VolumeOnboardingCreate) (*models.VolumeOnboardingCreateResponse, error) { - if f.session.IsOnPrem() { - return nil, fmt.Errorf("operation not supported in satellite location, check documentation") - } params := p_cloud_volume_onboarding.NewPcloudVolumeOnboardingPostParams(). WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithBody(body) diff --git a/power/client/datacenters/datacenters_client.go b/power/client/datacenters/datacenters_client.go index 9f9e449a..9ccf8b60 100644 --- a/power/client/datacenters/datacenters_client.go +++ b/power/client/datacenters/datacenters_client.go @@ -60,6 +60,10 @@ type ClientService interface { V1DatacentersGetall(params *V1DatacentersGetallParams, opts ...ClientOption) (*V1DatacentersGetallOK, error) + V1DatacentersPrivateGet(params *V1DatacentersPrivateGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1DatacentersPrivateGetOK, error) + + V1DatacentersPrivateGetall(params *V1DatacentersPrivateGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1DatacentersPrivateGetallOK, error) + SetTransport(transport runtime.ClientTransport) } @@ -139,6 +143,84 @@ func (a *Client) V1DatacentersGetall(params *V1DatacentersGetallParams, opts ... panic(msg) } +/* +V1DatacentersPrivateGet gets a private datacenter s information and capabilities +*/ +func (a *Client) V1DatacentersPrivateGet(params *V1DatacentersPrivateGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1DatacentersPrivateGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1DatacentersPrivateGetParams() + } + op := &runtime.ClientOperation{ + ID: "v1.datacentersPrivate.get", + Method: "GET", + PathPattern: "/v1/datacenters/private/{datacenter_region}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1DatacentersPrivateGetReader{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.(*V1DatacentersPrivateGetOK) + 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.datacentersPrivate.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1DatacentersPrivateGetall gets private datacenter information and capabilities +*/ +func (a *Client) V1DatacentersPrivateGetall(params *V1DatacentersPrivateGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1DatacentersPrivateGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1DatacentersPrivateGetallParams() + } + op := &runtime.ClientOperation{ + ID: "v1.datacentersPrivate.getall", + Method: "GET", + PathPattern: "/v1/datacenters/private", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1DatacentersPrivateGetallReader{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.(*V1DatacentersPrivateGetallOK) + 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.datacentersPrivate.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + // SetTransport changes the transport on the client func (a *Client) SetTransport(transport runtime.ClientTransport) { a.transport = transport diff --git a/power/client/datacenters/v1_datacenters_private_get_parameters.go b/power/client/datacenters/v1_datacenters_private_get_parameters.go new file mode 100644 index 00000000..df6f8e68 --- /dev/null +++ b/power/client/datacenters/v1_datacenters_private_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package datacenters + +// 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" +) + +// NewV1DatacentersPrivateGetParams creates a new V1DatacentersPrivateGetParams 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 NewV1DatacentersPrivateGetParams() *V1DatacentersPrivateGetParams { + return &V1DatacentersPrivateGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1DatacentersPrivateGetParamsWithTimeout creates a new V1DatacentersPrivateGetParams object +// with the ability to set a timeout on a request. +func NewV1DatacentersPrivateGetParamsWithTimeout(timeout time.Duration) *V1DatacentersPrivateGetParams { + return &V1DatacentersPrivateGetParams{ + timeout: timeout, + } +} + +// NewV1DatacentersPrivateGetParamsWithContext creates a new V1DatacentersPrivateGetParams object +// with the ability to set a context for a request. +func NewV1DatacentersPrivateGetParamsWithContext(ctx context.Context) *V1DatacentersPrivateGetParams { + return &V1DatacentersPrivateGetParams{ + Context: ctx, + } +} + +// NewV1DatacentersPrivateGetParamsWithHTTPClient creates a new V1DatacentersPrivateGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1DatacentersPrivateGetParamsWithHTTPClient(client *http.Client) *V1DatacentersPrivateGetParams { + return &V1DatacentersPrivateGetParams{ + HTTPClient: client, + } +} + +/* +V1DatacentersPrivateGetParams contains all the parameters to send to the API endpoint + + for the v1 datacenters private get operation. + + Typically these are written to a http.Request. +*/ +type V1DatacentersPrivateGetParams struct { + + /* DatacenterRegion. + + Datacenter Region + */ + DatacenterRegion string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 datacenters private get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1DatacentersPrivateGetParams) WithDefaults() *V1DatacentersPrivateGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 datacenters private get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1DatacentersPrivateGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 datacenters private get params +func (o *V1DatacentersPrivateGetParams) WithTimeout(timeout time.Duration) *V1DatacentersPrivateGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 datacenters private get params +func (o *V1DatacentersPrivateGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 datacenters private get params +func (o *V1DatacentersPrivateGetParams) WithContext(ctx context.Context) *V1DatacentersPrivateGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 datacenters private get params +func (o *V1DatacentersPrivateGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 datacenters private get params +func (o *V1DatacentersPrivateGetParams) WithHTTPClient(client *http.Client) *V1DatacentersPrivateGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 datacenters private get params +func (o *V1DatacentersPrivateGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDatacenterRegion adds the datacenterRegion to the v1 datacenters private get params +func (o *V1DatacentersPrivateGetParams) WithDatacenterRegion(datacenterRegion string) *V1DatacentersPrivateGetParams { + o.SetDatacenterRegion(datacenterRegion) + return o +} + +// SetDatacenterRegion adds the datacenterRegion to the v1 datacenters private get params +func (o *V1DatacentersPrivateGetParams) SetDatacenterRegion(datacenterRegion string) { + o.DatacenterRegion = datacenterRegion +} + +// WriteToRequest writes these params to a swagger request +func (o *V1DatacentersPrivateGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param datacenter_region + if err := r.SetPathParam("datacenter_region", o.DatacenterRegion); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/datacenters/v1_datacenters_private_get_responses.go b/power/client/datacenters/v1_datacenters_private_get_responses.go new file mode 100644 index 00000000..f23ed3a1 --- /dev/null +++ b/power/client/datacenters/v1_datacenters_private_get_responses.go @@ -0,0 +1,410 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package datacenters + +// 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" +) + +// V1DatacentersPrivateGetReader is a Reader for the V1DatacentersPrivateGet structure. +type V1DatacentersPrivateGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1DatacentersPrivateGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1DatacentersPrivateGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1DatacentersPrivateGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1DatacentersPrivateGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1DatacentersPrivateGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1DatacentersPrivateGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/datacenters/private/{datacenter_region}] v1.datacentersPrivate.get", response, response.Code()) + } +} + +// NewV1DatacentersPrivateGetOK creates a V1DatacentersPrivateGetOK with default headers values +func NewV1DatacentersPrivateGetOK() *V1DatacentersPrivateGetOK { + return &V1DatacentersPrivateGetOK{} +} + +/* +V1DatacentersPrivateGetOK describes a response with status code 200, with default header values. + +OK +*/ +type V1DatacentersPrivateGetOK struct { + Payload *models.Datacenter +} + +// IsSuccess returns true when this v1 datacenters private get o k response has a 2xx status code +func (o *V1DatacentersPrivateGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 datacenters private get o k response has a 3xx status code +func (o *V1DatacentersPrivateGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 datacenters private get o k response has a 4xx status code +func (o *V1DatacentersPrivateGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 datacenters private get o k response has a 5xx status code +func (o *V1DatacentersPrivateGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 datacenters private get o k response a status code equal to that given +func (o *V1DatacentersPrivateGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 datacenters private get o k response +func (o *V1DatacentersPrivateGetOK) Code() int { + return 200 +} + +func (o *V1DatacentersPrivateGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/datacenters/private/{datacenter_region}][%d] v1DatacentersPrivateGetOK %s", 200, payload) +} + +func (o *V1DatacentersPrivateGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/datacenters/private/{datacenter_region}][%d] v1DatacentersPrivateGetOK %s", 200, payload) +} + +func (o *V1DatacentersPrivateGetOK) GetPayload() *models.Datacenter { + return o.Payload +} + +func (o *V1DatacentersPrivateGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Datacenter) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1DatacentersPrivateGetBadRequest creates a V1DatacentersPrivateGetBadRequest with default headers values +func NewV1DatacentersPrivateGetBadRequest() *V1DatacentersPrivateGetBadRequest { + return &V1DatacentersPrivateGetBadRequest{} +} + +/* +V1DatacentersPrivateGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1DatacentersPrivateGetBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 datacenters private get bad request response has a 2xx status code +func (o *V1DatacentersPrivateGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 datacenters private get bad request response has a 3xx status code +func (o *V1DatacentersPrivateGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 datacenters private get bad request response has a 4xx status code +func (o *V1DatacentersPrivateGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 datacenters private get bad request response has a 5xx status code +func (o *V1DatacentersPrivateGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 datacenters private get bad request response a status code equal to that given +func (o *V1DatacentersPrivateGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 datacenters private get bad request response +func (o *V1DatacentersPrivateGetBadRequest) Code() int { + return 400 +} + +func (o *V1DatacentersPrivateGetBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/datacenters/private/{datacenter_region}][%d] v1DatacentersPrivateGetBadRequest %s", 400, payload) +} + +func (o *V1DatacentersPrivateGetBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/datacenters/private/{datacenter_region}][%d] v1DatacentersPrivateGetBadRequest %s", 400, payload) +} + +func (o *V1DatacentersPrivateGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1DatacentersPrivateGetBadRequest) 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 +} + +// NewV1DatacentersPrivateGetUnauthorized creates a V1DatacentersPrivateGetUnauthorized with default headers values +func NewV1DatacentersPrivateGetUnauthorized() *V1DatacentersPrivateGetUnauthorized { + return &V1DatacentersPrivateGetUnauthorized{} +} + +/* +V1DatacentersPrivateGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1DatacentersPrivateGetUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 datacenters private get unauthorized response has a 2xx status code +func (o *V1DatacentersPrivateGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 datacenters private get unauthorized response has a 3xx status code +func (o *V1DatacentersPrivateGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 datacenters private get unauthorized response has a 4xx status code +func (o *V1DatacentersPrivateGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 datacenters private get unauthorized response has a 5xx status code +func (o *V1DatacentersPrivateGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 datacenters private get unauthorized response a status code equal to that given +func (o *V1DatacentersPrivateGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 datacenters private get unauthorized response +func (o *V1DatacentersPrivateGetUnauthorized) Code() int { + return 401 +} + +func (o *V1DatacentersPrivateGetUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/datacenters/private/{datacenter_region}][%d] v1DatacentersPrivateGetUnauthorized %s", 401, payload) +} + +func (o *V1DatacentersPrivateGetUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/datacenters/private/{datacenter_region}][%d] v1DatacentersPrivateGetUnauthorized %s", 401, payload) +} + +func (o *V1DatacentersPrivateGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1DatacentersPrivateGetUnauthorized) 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 +} + +// NewV1DatacentersPrivateGetForbidden creates a V1DatacentersPrivateGetForbidden with default headers values +func NewV1DatacentersPrivateGetForbidden() *V1DatacentersPrivateGetForbidden { + return &V1DatacentersPrivateGetForbidden{} +} + +/* +V1DatacentersPrivateGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1DatacentersPrivateGetForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 datacenters private get forbidden response has a 2xx status code +func (o *V1DatacentersPrivateGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 datacenters private get forbidden response has a 3xx status code +func (o *V1DatacentersPrivateGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 datacenters private get forbidden response has a 4xx status code +func (o *V1DatacentersPrivateGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 datacenters private get forbidden response has a 5xx status code +func (o *V1DatacentersPrivateGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 datacenters private get forbidden response a status code equal to that given +func (o *V1DatacentersPrivateGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 datacenters private get forbidden response +func (o *V1DatacentersPrivateGetForbidden) Code() int { + return 403 +} + +func (o *V1DatacentersPrivateGetForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/datacenters/private/{datacenter_region}][%d] v1DatacentersPrivateGetForbidden %s", 403, payload) +} + +func (o *V1DatacentersPrivateGetForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/datacenters/private/{datacenter_region}][%d] v1DatacentersPrivateGetForbidden %s", 403, payload) +} + +func (o *V1DatacentersPrivateGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1DatacentersPrivateGetForbidden) 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 +} + +// NewV1DatacentersPrivateGetInternalServerError creates a V1DatacentersPrivateGetInternalServerError with default headers values +func NewV1DatacentersPrivateGetInternalServerError() *V1DatacentersPrivateGetInternalServerError { + return &V1DatacentersPrivateGetInternalServerError{} +} + +/* +V1DatacentersPrivateGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1DatacentersPrivateGetInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 datacenters private get internal server error response has a 2xx status code +func (o *V1DatacentersPrivateGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 datacenters private get internal server error response has a 3xx status code +func (o *V1DatacentersPrivateGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 datacenters private get internal server error response has a 4xx status code +func (o *V1DatacentersPrivateGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 datacenters private get internal server error response has a 5xx status code +func (o *V1DatacentersPrivateGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 datacenters private get internal server error response a status code equal to that given +func (o *V1DatacentersPrivateGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 datacenters private get internal server error response +func (o *V1DatacentersPrivateGetInternalServerError) Code() int { + return 500 +} + +func (o *V1DatacentersPrivateGetInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/datacenters/private/{datacenter_region}][%d] v1DatacentersPrivateGetInternalServerError %s", 500, payload) +} + +func (o *V1DatacentersPrivateGetInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/datacenters/private/{datacenter_region}][%d] v1DatacentersPrivateGetInternalServerError %s", 500, payload) +} + +func (o *V1DatacentersPrivateGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1DatacentersPrivateGetInternalServerError) 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/datacenters/v1_datacenters_private_getall_parameters.go b/power/client/datacenters/v1_datacenters_private_getall_parameters.go new file mode 100644 index 00000000..81fa3ae8 --- /dev/null +++ b/power/client/datacenters/v1_datacenters_private_getall_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package datacenters + +// 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" +) + +// NewV1DatacentersPrivateGetallParams creates a new V1DatacentersPrivateGetallParams 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 NewV1DatacentersPrivateGetallParams() *V1DatacentersPrivateGetallParams { + return &V1DatacentersPrivateGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1DatacentersPrivateGetallParamsWithTimeout creates a new V1DatacentersPrivateGetallParams object +// with the ability to set a timeout on a request. +func NewV1DatacentersPrivateGetallParamsWithTimeout(timeout time.Duration) *V1DatacentersPrivateGetallParams { + return &V1DatacentersPrivateGetallParams{ + timeout: timeout, + } +} + +// NewV1DatacentersPrivateGetallParamsWithContext creates a new V1DatacentersPrivateGetallParams object +// with the ability to set a context for a request. +func NewV1DatacentersPrivateGetallParamsWithContext(ctx context.Context) *V1DatacentersPrivateGetallParams { + return &V1DatacentersPrivateGetallParams{ + Context: ctx, + } +} + +// NewV1DatacentersPrivateGetallParamsWithHTTPClient creates a new V1DatacentersPrivateGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1DatacentersPrivateGetallParamsWithHTTPClient(client *http.Client) *V1DatacentersPrivateGetallParams { + return &V1DatacentersPrivateGetallParams{ + HTTPClient: client, + } +} + +/* +V1DatacentersPrivateGetallParams contains all the parameters to send to the API endpoint + + for the v1 datacenters private getall operation. + + Typically these are written to a http.Request. +*/ +type V1DatacentersPrivateGetallParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 datacenters private getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1DatacentersPrivateGetallParams) WithDefaults() *V1DatacentersPrivateGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 datacenters private getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1DatacentersPrivateGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 datacenters private getall params +func (o *V1DatacentersPrivateGetallParams) WithTimeout(timeout time.Duration) *V1DatacentersPrivateGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 datacenters private getall params +func (o *V1DatacentersPrivateGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 datacenters private getall params +func (o *V1DatacentersPrivateGetallParams) WithContext(ctx context.Context) *V1DatacentersPrivateGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 datacenters private getall params +func (o *V1DatacentersPrivateGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 datacenters private getall params +func (o *V1DatacentersPrivateGetallParams) WithHTTPClient(client *http.Client) *V1DatacentersPrivateGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 datacenters private getall params +func (o *V1DatacentersPrivateGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *V1DatacentersPrivateGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/datacenters/v1_datacenters_private_getall_responses.go b/power/client/datacenters/v1_datacenters_private_getall_responses.go new file mode 100644 index 00000000..f4ba186a --- /dev/null +++ b/power/client/datacenters/v1_datacenters_private_getall_responses.go @@ -0,0 +1,410 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package datacenters + +// 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" +) + +// V1DatacentersPrivateGetallReader is a Reader for the V1DatacentersPrivateGetall structure. +type V1DatacentersPrivateGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1DatacentersPrivateGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1DatacentersPrivateGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1DatacentersPrivateGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1DatacentersPrivateGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1DatacentersPrivateGetallForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1DatacentersPrivateGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/datacenters/private] v1.datacentersPrivate.getall", response, response.Code()) + } +} + +// NewV1DatacentersPrivateGetallOK creates a V1DatacentersPrivateGetallOK with default headers values +func NewV1DatacentersPrivateGetallOK() *V1DatacentersPrivateGetallOK { + return &V1DatacentersPrivateGetallOK{} +} + +/* +V1DatacentersPrivateGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type V1DatacentersPrivateGetallOK struct { + Payload *models.Datacenters +} + +// IsSuccess returns true when this v1 datacenters private getall o k response has a 2xx status code +func (o *V1DatacentersPrivateGetallOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 datacenters private getall o k response has a 3xx status code +func (o *V1DatacentersPrivateGetallOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 datacenters private getall o k response has a 4xx status code +func (o *V1DatacentersPrivateGetallOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 datacenters private getall o k response has a 5xx status code +func (o *V1DatacentersPrivateGetallOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 datacenters private getall o k response a status code equal to that given +func (o *V1DatacentersPrivateGetallOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 datacenters private getall o k response +func (o *V1DatacentersPrivateGetallOK) Code() int { + return 200 +} + +func (o *V1DatacentersPrivateGetallOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/datacenters/private][%d] v1DatacentersPrivateGetallOK %s", 200, payload) +} + +func (o *V1DatacentersPrivateGetallOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/datacenters/private][%d] v1DatacentersPrivateGetallOK %s", 200, payload) +} + +func (o *V1DatacentersPrivateGetallOK) GetPayload() *models.Datacenters { + return o.Payload +} + +func (o *V1DatacentersPrivateGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Datacenters) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1DatacentersPrivateGetallBadRequest creates a V1DatacentersPrivateGetallBadRequest with default headers values +func NewV1DatacentersPrivateGetallBadRequest() *V1DatacentersPrivateGetallBadRequest { + return &V1DatacentersPrivateGetallBadRequest{} +} + +/* +V1DatacentersPrivateGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1DatacentersPrivateGetallBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 datacenters private getall bad request response has a 2xx status code +func (o *V1DatacentersPrivateGetallBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 datacenters private getall bad request response has a 3xx status code +func (o *V1DatacentersPrivateGetallBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 datacenters private getall bad request response has a 4xx status code +func (o *V1DatacentersPrivateGetallBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 datacenters private getall bad request response has a 5xx status code +func (o *V1DatacentersPrivateGetallBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 datacenters private getall bad request response a status code equal to that given +func (o *V1DatacentersPrivateGetallBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 datacenters private getall bad request response +func (o *V1DatacentersPrivateGetallBadRequest) Code() int { + return 400 +} + +func (o *V1DatacentersPrivateGetallBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/datacenters/private][%d] v1DatacentersPrivateGetallBadRequest %s", 400, payload) +} + +func (o *V1DatacentersPrivateGetallBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/datacenters/private][%d] v1DatacentersPrivateGetallBadRequest %s", 400, payload) +} + +func (o *V1DatacentersPrivateGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1DatacentersPrivateGetallBadRequest) 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 +} + +// NewV1DatacentersPrivateGetallUnauthorized creates a V1DatacentersPrivateGetallUnauthorized with default headers values +func NewV1DatacentersPrivateGetallUnauthorized() *V1DatacentersPrivateGetallUnauthorized { + return &V1DatacentersPrivateGetallUnauthorized{} +} + +/* +V1DatacentersPrivateGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1DatacentersPrivateGetallUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 datacenters private getall unauthorized response has a 2xx status code +func (o *V1DatacentersPrivateGetallUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 datacenters private getall unauthorized response has a 3xx status code +func (o *V1DatacentersPrivateGetallUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 datacenters private getall unauthorized response has a 4xx status code +func (o *V1DatacentersPrivateGetallUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 datacenters private getall unauthorized response has a 5xx status code +func (o *V1DatacentersPrivateGetallUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 datacenters private getall unauthorized response a status code equal to that given +func (o *V1DatacentersPrivateGetallUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 datacenters private getall unauthorized response +func (o *V1DatacentersPrivateGetallUnauthorized) Code() int { + return 401 +} + +func (o *V1DatacentersPrivateGetallUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/datacenters/private][%d] v1DatacentersPrivateGetallUnauthorized %s", 401, payload) +} + +func (o *V1DatacentersPrivateGetallUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/datacenters/private][%d] v1DatacentersPrivateGetallUnauthorized %s", 401, payload) +} + +func (o *V1DatacentersPrivateGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1DatacentersPrivateGetallUnauthorized) 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 +} + +// NewV1DatacentersPrivateGetallForbidden creates a V1DatacentersPrivateGetallForbidden with default headers values +func NewV1DatacentersPrivateGetallForbidden() *V1DatacentersPrivateGetallForbidden { + return &V1DatacentersPrivateGetallForbidden{} +} + +/* +V1DatacentersPrivateGetallForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1DatacentersPrivateGetallForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 datacenters private getall forbidden response has a 2xx status code +func (o *V1DatacentersPrivateGetallForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 datacenters private getall forbidden response has a 3xx status code +func (o *V1DatacentersPrivateGetallForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 datacenters private getall forbidden response has a 4xx status code +func (o *V1DatacentersPrivateGetallForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 datacenters private getall forbidden response has a 5xx status code +func (o *V1DatacentersPrivateGetallForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 datacenters private getall forbidden response a status code equal to that given +func (o *V1DatacentersPrivateGetallForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 datacenters private getall forbidden response +func (o *V1DatacentersPrivateGetallForbidden) Code() int { + return 403 +} + +func (o *V1DatacentersPrivateGetallForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/datacenters/private][%d] v1DatacentersPrivateGetallForbidden %s", 403, payload) +} + +func (o *V1DatacentersPrivateGetallForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/datacenters/private][%d] v1DatacentersPrivateGetallForbidden %s", 403, payload) +} + +func (o *V1DatacentersPrivateGetallForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1DatacentersPrivateGetallForbidden) 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 +} + +// NewV1DatacentersPrivateGetallInternalServerError creates a V1DatacentersPrivateGetallInternalServerError with default headers values +func NewV1DatacentersPrivateGetallInternalServerError() *V1DatacentersPrivateGetallInternalServerError { + return &V1DatacentersPrivateGetallInternalServerError{} +} + +/* +V1DatacentersPrivateGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1DatacentersPrivateGetallInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 datacenters private getall internal server error response has a 2xx status code +func (o *V1DatacentersPrivateGetallInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 datacenters private getall internal server error response has a 3xx status code +func (o *V1DatacentersPrivateGetallInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 datacenters private getall internal server error response has a 4xx status code +func (o *V1DatacentersPrivateGetallInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 datacenters private getall internal server error response has a 5xx status code +func (o *V1DatacentersPrivateGetallInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 datacenters private getall internal server error response a status code equal to that given +func (o *V1DatacentersPrivateGetallInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 datacenters private getall internal server error response +func (o *V1DatacentersPrivateGetallInternalServerError) Code() int { + return 500 +} + +func (o *V1DatacentersPrivateGetallInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/datacenters/private][%d] v1DatacentersPrivateGetallInternalServerError %s", 500, payload) +} + +func (o *V1DatacentersPrivateGetallInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/datacenters/private][%d] v1DatacentersPrivateGetallInternalServerError %s", 500, payload) +} + +func (o *V1DatacentersPrivateGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1DatacentersPrivateGetallInternalServerError) 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/host_groups/v1_hosts_get_parameters.go b/power/client/host_groups/v1_hosts_get_parameters.go index b4139ea5..d38611fc 100644 --- a/power/client/host_groups/v1_hosts_get_parameters.go +++ b/power/client/host_groups/v1_hosts_get_parameters.go @@ -14,6 +14,7 @@ import ( "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) // NewV1HostsGetParams creates a new V1HostsGetParams object, @@ -60,6 +61,10 @@ V1HostsGetParams contains all the parameters to send to the API endpoint Typically these are written to a http.Request. */ type V1HostsGetParams struct { + + // HostReference. + HostReference *bool + timeout time.Duration Context context.Context HTTPClient *http.Client @@ -113,6 +118,17 @@ func (o *V1HostsGetParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client } +// WithHostReference adds the hostReference to the v1 hosts get params +func (o *V1HostsGetParams) WithHostReference(hostReference *bool) *V1HostsGetParams { + o.SetHostReference(hostReference) + return o +} + +// SetHostReference adds the hostReference to the v1 hosts get params +func (o *V1HostsGetParams) SetHostReference(hostReference *bool) { + o.HostReference = hostReference +} + // WriteToRequest writes these params to a swagger request func (o *V1HostsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { @@ -121,6 +137,23 @@ func (o *V1HostsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re } var res []error + if o.HostReference != nil { + + // query param host_reference + var qrHostReference bool + + if o.HostReference != nil { + qrHostReference = *o.HostReference + } + qHostReference := swag.FormatBool(qrHostReference) + if qHostReference != "" { + + if err := r.SetQueryParam("host_reference", qHostReference); err != nil { + return err + } + } + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } diff --git a/power/client/host_groups/v1_hosts_id_get_parameters.go b/power/client/host_groups/v1_hosts_id_get_parameters.go index 422c12ff..ab0e789f 100644 --- a/power/client/host_groups/v1_hosts_id_get_parameters.go +++ b/power/client/host_groups/v1_hosts_id_get_parameters.go @@ -14,6 +14,7 @@ import ( "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) // NewV1HostsIDGetParams creates a new V1HostsIDGetParams object, @@ -67,6 +68,9 @@ type V1HostsIDGetParams struct { */ HostID string + // HostReference. + HostReference *bool + timeout time.Duration Context context.Context HTTPClient *http.Client @@ -131,6 +135,17 @@ func (o *V1HostsIDGetParams) SetHostID(hostID string) { o.HostID = hostID } +// WithHostReference adds the hostReference to the v1 hosts id get params +func (o *V1HostsIDGetParams) WithHostReference(hostReference *bool) *V1HostsIDGetParams { + o.SetHostReference(hostReference) + return o +} + +// SetHostReference adds the hostReference to the v1 hosts id get params +func (o *V1HostsIDGetParams) SetHostReference(hostReference *bool) { + o.HostReference = hostReference +} + // WriteToRequest writes these params to a swagger request func (o *V1HostsIDGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { @@ -144,6 +159,23 @@ func (o *V1HostsIDGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } + if o.HostReference != nil { + + // query param host_reference + var qrHostReference bool + + if o.HostReference != nil { + qrHostReference = *o.HostReference + } + qHostReference := swag.FormatBool(qrHostReference) + if qHostReference != "" { + + if err := r.SetQueryParam("host_reference", qHostReference); err != nil { + return err + } + } + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } diff --git a/power/client/network_peers/network_peers_client.go b/power/client/network_peers/network_peers_client.go new file mode 100644 index 00000000..9ee1ad1f --- /dev/null +++ b/power/client/network_peers/network_peers_client.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_peers + +// 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 network peers API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new network peers 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 network peers 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 network peers 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 { + V1NetworkPeersList(params *V1NetworkPeersListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkPeersListOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +V1NetworkPeersList lists all network peers available in the workspace +*/ +func (a *Client) V1NetworkPeersList(params *V1NetworkPeersListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkPeersListOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkPeersListParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkPeers.list", + Method: "GET", + PathPattern: "/v1/network-peers", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkPeersListReader{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.(*V1NetworkPeersListOK) + 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.networkPeers.list: 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/network_peers/v1_network_peers_list_parameters.go b/power/client/network_peers/v1_network_peers_list_parameters.go new file mode 100644 index 00000000..d1f16af6 --- /dev/null +++ b/power/client/network_peers/v1_network_peers_list_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_peers + +// 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" +) + +// NewV1NetworkPeersListParams creates a new V1NetworkPeersListParams 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 NewV1NetworkPeersListParams() *V1NetworkPeersListParams { + return &V1NetworkPeersListParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkPeersListParamsWithTimeout creates a new V1NetworkPeersListParams object +// with the ability to set a timeout on a request. +func NewV1NetworkPeersListParamsWithTimeout(timeout time.Duration) *V1NetworkPeersListParams { + return &V1NetworkPeersListParams{ + timeout: timeout, + } +} + +// NewV1NetworkPeersListParamsWithContext creates a new V1NetworkPeersListParams object +// with the ability to set a context for a request. +func NewV1NetworkPeersListParamsWithContext(ctx context.Context) *V1NetworkPeersListParams { + return &V1NetworkPeersListParams{ + Context: ctx, + } +} + +// NewV1NetworkPeersListParamsWithHTTPClient creates a new V1NetworkPeersListParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkPeersListParamsWithHTTPClient(client *http.Client) *V1NetworkPeersListParams { + return &V1NetworkPeersListParams{ + HTTPClient: client, + } +} + +/* +V1NetworkPeersListParams contains all the parameters to send to the API endpoint + + for the v1 network peers list operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkPeersListParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network peers list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkPeersListParams) WithDefaults() *V1NetworkPeersListParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network peers list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkPeersListParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network peers list params +func (o *V1NetworkPeersListParams) WithTimeout(timeout time.Duration) *V1NetworkPeersListParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network peers list params +func (o *V1NetworkPeersListParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network peers list params +func (o *V1NetworkPeersListParams) WithContext(ctx context.Context) *V1NetworkPeersListParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network peers list params +func (o *V1NetworkPeersListParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network peers list params +func (o *V1NetworkPeersListParams) WithHTTPClient(client *http.Client) *V1NetworkPeersListParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network peers list params +func (o *V1NetworkPeersListParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkPeersListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_peers/v1_network_peers_list_responses.go b/power/client/network_peers/v1_network_peers_list_responses.go new file mode 100644 index 00000000..63349c87 --- /dev/null +++ b/power/client/network_peers/v1_network_peers_list_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_peers + +// 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" +) + +// V1NetworkPeersListReader is a Reader for the V1NetworkPeersList structure. +type V1NetworkPeersListReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkPeersListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkPeersListOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkPeersListBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkPeersListUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkPeersListForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkPeersListNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkPeersListInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/network-peers] v1.networkPeers.list", response, response.Code()) + } +} + +// NewV1NetworkPeersListOK creates a V1NetworkPeersListOK with default headers values +func NewV1NetworkPeersListOK() *V1NetworkPeersListOK { + return &V1NetworkPeersListOK{} +} + +/* +V1NetworkPeersListOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkPeersListOK struct { + Payload *models.NetworkPeers +} + +// IsSuccess returns true when this v1 network peers list o k response has a 2xx status code +func (o *V1NetworkPeersListOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network peers list o k response has a 3xx status code +func (o *V1NetworkPeersListOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network peers list o k response has a 4xx status code +func (o *V1NetworkPeersListOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network peers list o k response has a 5xx status code +func (o *V1NetworkPeersListOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network peers list o k response a status code equal to that given +func (o *V1NetworkPeersListOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network peers list o k response +func (o *V1NetworkPeersListOK) Code() int { + return 200 +} + +func (o *V1NetworkPeersListOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-peers][%d] v1NetworkPeersListOK %s", 200, payload) +} + +func (o *V1NetworkPeersListOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-peers][%d] v1NetworkPeersListOK %s", 200, payload) +} + +func (o *V1NetworkPeersListOK) GetPayload() *models.NetworkPeers { + return o.Payload +} + +func (o *V1NetworkPeersListOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkPeers) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkPeersListBadRequest creates a V1NetworkPeersListBadRequest with default headers values +func NewV1NetworkPeersListBadRequest() *V1NetworkPeersListBadRequest { + return &V1NetworkPeersListBadRequest{} +} + +/* +V1NetworkPeersListBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkPeersListBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network peers list bad request response has a 2xx status code +func (o *V1NetworkPeersListBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network peers list bad request response has a 3xx status code +func (o *V1NetworkPeersListBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network peers list bad request response has a 4xx status code +func (o *V1NetworkPeersListBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network peers list bad request response has a 5xx status code +func (o *V1NetworkPeersListBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network peers list bad request response a status code equal to that given +func (o *V1NetworkPeersListBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network peers list bad request response +func (o *V1NetworkPeersListBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkPeersListBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-peers][%d] v1NetworkPeersListBadRequest %s", 400, payload) +} + +func (o *V1NetworkPeersListBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-peers][%d] v1NetworkPeersListBadRequest %s", 400, payload) +} + +func (o *V1NetworkPeersListBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkPeersListBadRequest) 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 +} + +// NewV1NetworkPeersListUnauthorized creates a V1NetworkPeersListUnauthorized with default headers values +func NewV1NetworkPeersListUnauthorized() *V1NetworkPeersListUnauthorized { + return &V1NetworkPeersListUnauthorized{} +} + +/* +V1NetworkPeersListUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkPeersListUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network peers list unauthorized response has a 2xx status code +func (o *V1NetworkPeersListUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network peers list unauthorized response has a 3xx status code +func (o *V1NetworkPeersListUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network peers list unauthorized response has a 4xx status code +func (o *V1NetworkPeersListUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network peers list unauthorized response has a 5xx status code +func (o *V1NetworkPeersListUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network peers list unauthorized response a status code equal to that given +func (o *V1NetworkPeersListUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network peers list unauthorized response +func (o *V1NetworkPeersListUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkPeersListUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-peers][%d] v1NetworkPeersListUnauthorized %s", 401, payload) +} + +func (o *V1NetworkPeersListUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-peers][%d] v1NetworkPeersListUnauthorized %s", 401, payload) +} + +func (o *V1NetworkPeersListUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkPeersListUnauthorized) 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 +} + +// NewV1NetworkPeersListForbidden creates a V1NetworkPeersListForbidden with default headers values +func NewV1NetworkPeersListForbidden() *V1NetworkPeersListForbidden { + return &V1NetworkPeersListForbidden{} +} + +/* +V1NetworkPeersListForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkPeersListForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network peers list forbidden response has a 2xx status code +func (o *V1NetworkPeersListForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network peers list forbidden response has a 3xx status code +func (o *V1NetworkPeersListForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network peers list forbidden response has a 4xx status code +func (o *V1NetworkPeersListForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network peers list forbidden response has a 5xx status code +func (o *V1NetworkPeersListForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network peers list forbidden response a status code equal to that given +func (o *V1NetworkPeersListForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network peers list forbidden response +func (o *V1NetworkPeersListForbidden) Code() int { + return 403 +} + +func (o *V1NetworkPeersListForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-peers][%d] v1NetworkPeersListForbidden %s", 403, payload) +} + +func (o *V1NetworkPeersListForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-peers][%d] v1NetworkPeersListForbidden %s", 403, payload) +} + +func (o *V1NetworkPeersListForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkPeersListForbidden) 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 +} + +// NewV1NetworkPeersListNotFound creates a V1NetworkPeersListNotFound with default headers values +func NewV1NetworkPeersListNotFound() *V1NetworkPeersListNotFound { + return &V1NetworkPeersListNotFound{} +} + +/* +V1NetworkPeersListNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkPeersListNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network peers list not found response has a 2xx status code +func (o *V1NetworkPeersListNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network peers list not found response has a 3xx status code +func (o *V1NetworkPeersListNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network peers list not found response has a 4xx status code +func (o *V1NetworkPeersListNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network peers list not found response has a 5xx status code +func (o *V1NetworkPeersListNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network peers list not found response a status code equal to that given +func (o *V1NetworkPeersListNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network peers list not found response +func (o *V1NetworkPeersListNotFound) Code() int { + return 404 +} + +func (o *V1NetworkPeersListNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-peers][%d] v1NetworkPeersListNotFound %s", 404, payload) +} + +func (o *V1NetworkPeersListNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-peers][%d] v1NetworkPeersListNotFound %s", 404, payload) +} + +func (o *V1NetworkPeersListNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkPeersListNotFound) 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 +} + +// NewV1NetworkPeersListInternalServerError creates a V1NetworkPeersListInternalServerError with default headers values +func NewV1NetworkPeersListInternalServerError() *V1NetworkPeersListInternalServerError { + return &V1NetworkPeersListInternalServerError{} +} + +/* +V1NetworkPeersListInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkPeersListInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network peers list internal server error response has a 2xx status code +func (o *V1NetworkPeersListInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network peers list internal server error response has a 3xx status code +func (o *V1NetworkPeersListInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network peers list internal server error response has a 4xx status code +func (o *V1NetworkPeersListInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network peers list internal server error response has a 5xx status code +func (o *V1NetworkPeersListInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network peers list internal server error response a status code equal to that given +func (o *V1NetworkPeersListInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network peers list internal server error response +func (o *V1NetworkPeersListInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkPeersListInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-peers][%d] v1NetworkPeersListInternalServerError %s", 500, payload) +} + +func (o *V1NetworkPeersListInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-peers][%d] v1NetworkPeersListInternalServerError %s", 500, payload) +} + +func (o *V1NetworkPeersListInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkPeersListInternalServerError) 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/p_cloud_p_vm_instances/pcloud_pvminstances_delete_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_delete_parameters.go index 61981333..77401f52 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_delete_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_delete_parameters.go @@ -15,6 +15,8 @@ import ( cr "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + + "github.com/IBM-Cloud/power-go-client/power/models" ) // NewPcloudPvminstancesDeleteParams creates a new PcloudPvminstancesDeleteParams object, @@ -62,6 +64,12 @@ PcloudPvminstancesDeleteParams contains all the parameters to send to the API en */ type PcloudPvminstancesDeleteParams struct { + /* Body. + + Parameters to delete a PVM Instance + */ + Body *models.PVMInstanceDelete + /* CloudInstanceID. Cloud Instance ID of a PCloud Instance @@ -133,6 +141,17 @@ func (o *PcloudPvminstancesDeleteParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client } +// WithBody adds the body to the pcloud pvminstances delete params +func (o *PcloudPvminstancesDeleteParams) WithBody(body *models.PVMInstanceDelete) *PcloudPvminstancesDeleteParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud pvminstances delete params +func (o *PcloudPvminstancesDeleteParams) SetBody(body *models.PVMInstanceDelete) { + o.Body = body +} + // WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances delete params func (o *PcloudPvminstancesDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesDeleteParams { o.SetCloudInstanceID(cloudInstanceID) @@ -173,6 +192,11 @@ func (o *PcloudPvminstancesDeleteParams) WriteToRequest(r runtime.ClientRequest, return err } var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } // path param cloud_instance_id if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { diff --git a/power/client/p_cloud_virtual_serial_number/p_cloud_virtual_serial_number_client.go b/power/client/p_cloud_virtual_serial_number/p_cloud_virtual_serial_number_client.go new file mode 100644 index 00000000..709da60f --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/p_cloud_virtual_serial_number_client.go @@ -0,0 +1,393 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_virtual_serial_number + +// 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 p cloud virtual serial number API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new p cloud virtual serial number 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 p cloud virtual serial number 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 p cloud virtual serial number 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 { + PcloudPvminstancesVirtualserialnumberDelete(params *PcloudPvminstancesVirtualserialnumberDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVirtualserialnumberDeleteAccepted, error) + + PcloudPvminstancesVirtualserialnumberGet(params *PcloudPvminstancesVirtualserialnumberGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVirtualserialnumberGetOK, error) + + PcloudPvminstancesVirtualserialnumberPost(params *PcloudPvminstancesVirtualserialnumberPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVirtualserialnumberPostAccepted, error) + + PcloudPvminstancesVirtualserialnumberPut(params *PcloudPvminstancesVirtualserialnumberPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVirtualserialnumberPutOK, error) + + PcloudVirtualserialnumberDelete(params *PcloudVirtualserialnumberDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVirtualserialnumberDeleteOK, error) + + PcloudVirtualserialnumberGet(params *PcloudVirtualserialnumberGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVirtualserialnumberGetOK, error) + + PcloudVirtualserialnumberGetall(params *PcloudVirtualserialnumberGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVirtualserialnumberGetallOK, error) + + PcloudVirtualserialnumberPut(params *PcloudVirtualserialnumberPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVirtualserialnumberPutOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +PcloudPvminstancesVirtualserialnumberDelete unassigns virtual serial number from a p VM instance +*/ +func (a *Client) PcloudPvminstancesVirtualserialnumberDelete(params *PcloudPvminstancesVirtualserialnumberDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVirtualserialnumberDeleteAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesVirtualserialnumberDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.virtualserialnumber.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesVirtualserialnumberDeleteReader{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.(*PcloudPvminstancesVirtualserialnumberDeleteAccepted) + 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 pcloud.pvminstances.virtualserialnumber.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PcloudPvminstancesVirtualserialnumberGet gets a p VM instance s virtual serial number information +*/ +func (a *Client) PcloudPvminstancesVirtualserialnumberGet(params *PcloudPvminstancesVirtualserialnumberGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVirtualserialnumberGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesVirtualserialnumberGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.virtualserialnumber.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesVirtualserialnumberGetReader{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.(*PcloudPvminstancesVirtualserialnumberGetOK) + 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 pcloud.pvminstances.virtualserialnumber.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PcloudPvminstancesVirtualserialnumberPost assigns virtual serial number to a p VM instance +*/ +func (a *Client) PcloudPvminstancesVirtualserialnumberPost(params *PcloudPvminstancesVirtualserialnumberPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVirtualserialnumberPostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesVirtualserialnumberPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.virtualserialnumber.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesVirtualserialnumberPostReader{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.(*PcloudPvminstancesVirtualserialnumberPostAccepted) + 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 pcloud.pvminstances.virtualserialnumber.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PcloudPvminstancesVirtualserialnumberPut updates description of a virtual serial number +*/ +func (a *Client) PcloudPvminstancesVirtualserialnumberPut(params *PcloudPvminstancesVirtualserialnumberPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVirtualserialnumberPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesVirtualserialnumberPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.virtualserialnumber.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesVirtualserialnumberPutReader{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.(*PcloudPvminstancesVirtualserialnumberPutOK) + 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 pcloud.pvminstances.virtualserialnumber.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PcloudVirtualserialnumberDelete unreserves a retained virtual serial number +*/ +func (a *Client) PcloudVirtualserialnumberDelete(params *PcloudVirtualserialnumberDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVirtualserialnumberDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVirtualserialnumberDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.virtualserialnumber.delete", + Method: "DELETE", + PathPattern: "/v1/virtual-serial-number/{virtual_serial_number}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVirtualserialnumberDeleteReader{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.(*PcloudVirtualserialnumberDeleteOK) + 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 pcloud.virtualserialnumber.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PcloudVirtualserialnumberGet gets information for a virtual serial number +*/ +func (a *Client) PcloudVirtualserialnumberGet(params *PcloudVirtualserialnumberGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVirtualserialnumberGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVirtualserialnumberGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.virtualserialnumber.get", + Method: "GET", + PathPattern: "/v1/virtual-serial-number/{virtual_serial_number}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVirtualserialnumberGetReader{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.(*PcloudVirtualserialnumberGetOK) + 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 pcloud.virtualserialnumber.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PcloudVirtualserialnumberGetall lists all utilized and retained v s ns +*/ +func (a *Client) PcloudVirtualserialnumberGetall(params *PcloudVirtualserialnumberGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVirtualserialnumberGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVirtualserialnumberGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.virtualserialnumber.getall", + Method: "GET", + PathPattern: "/v1/virtual-serial-number", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVirtualserialnumberGetallReader{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.(*PcloudVirtualserialnumberGetallOK) + 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 pcloud.virtualserialnumber.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PcloudVirtualserialnumberPut updates description of a reserved virtual serial number +*/ +func (a *Client) PcloudVirtualserialnumberPut(params *PcloudVirtualserialnumberPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVirtualserialnumberPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVirtualserialnumberPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.virtualserialnumber.put", + Method: "PUT", + PathPattern: "/v1/virtual-serial-number/{virtual_serial_number}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVirtualserialnumberPutReader{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.(*PcloudVirtualserialnumberPutOK) + 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 pcloud.virtualserialnumber.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/p_cloud_virtual_serial_number/pcloud_cloudinstances_virtual_serial_number_getall_parameters.go b/power/client/p_cloud_virtual_serial_number/pcloud_cloudinstances_virtual_serial_number_getall_parameters.go new file mode 100644 index 00000000..3f54fca4 --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/pcloud_cloudinstances_virtual_serial_number_getall_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_virtual_serial_number + +// 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" +) + +// NewPcloudCloudinstancesVirtualSerialNumberGetallParams creates a new PcloudCloudinstancesVirtualSerialNumberGetallParams 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 NewPcloudCloudinstancesVirtualSerialNumberGetallParams() *PcloudCloudinstancesVirtualSerialNumberGetallParams { + return &PcloudCloudinstancesVirtualSerialNumberGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesVirtualSerialNumberGetallParamsWithTimeout creates a new PcloudCloudinstancesVirtualSerialNumberGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesVirtualSerialNumberGetallParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesVirtualSerialNumberGetallParams { + return &PcloudCloudinstancesVirtualSerialNumberGetallParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesVirtualSerialNumberGetallParamsWithContext creates a new PcloudCloudinstancesVirtualSerialNumberGetallParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesVirtualSerialNumberGetallParamsWithContext(ctx context.Context) *PcloudCloudinstancesVirtualSerialNumberGetallParams { + return &PcloudCloudinstancesVirtualSerialNumberGetallParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesVirtualSerialNumberGetallParamsWithHTTPClient creates a new PcloudCloudinstancesVirtualSerialNumberGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesVirtualSerialNumberGetallParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesVirtualSerialNumberGetallParams { + return &PcloudCloudinstancesVirtualSerialNumberGetallParams{ + HTTPClient: client, + } +} + +/* +PcloudCloudinstancesVirtualSerialNumberGetallParams contains all the parameters to send to the API endpoint + + for the pcloud cloudinstances virtual serial number getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesVirtualSerialNumberGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances virtual serial number getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVirtualSerialNumberGetallParams) WithDefaults() *PcloudCloudinstancesVirtualSerialNumberGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances virtual serial number getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVirtualSerialNumberGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances virtual serial number getall params +func (o *PcloudCloudinstancesVirtualSerialNumberGetallParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesVirtualSerialNumberGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances virtual serial number getall params +func (o *PcloudCloudinstancesVirtualSerialNumberGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances virtual serial number getall params +func (o *PcloudCloudinstancesVirtualSerialNumberGetallParams) WithContext(ctx context.Context) *PcloudCloudinstancesVirtualSerialNumberGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances virtual serial number getall params +func (o *PcloudCloudinstancesVirtualSerialNumberGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances virtual serial number getall params +func (o *PcloudCloudinstancesVirtualSerialNumberGetallParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesVirtualSerialNumberGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances virtual serial number getall params +func (o *PcloudCloudinstancesVirtualSerialNumberGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances virtual serial number getall params +func (o *PcloudCloudinstancesVirtualSerialNumberGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesVirtualSerialNumberGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances virtual serial number getall params +func (o *PcloudCloudinstancesVirtualSerialNumberGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesVirtualSerialNumberGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/p_cloud_virtual_serial_number/pcloud_cloudinstances_virtual_serial_number_getall_responses.go b/power/client/p_cloud_virtual_serial_number/pcloud_cloudinstances_virtual_serial_number_getall_responses.go new file mode 100644 index 00000000..37efbafd --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/pcloud_cloudinstances_virtual_serial_number_getall_responses.go @@ -0,0 +1,484 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_virtual_serial_number + +// 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" +) + +// PcloudCloudinstancesVirtualSerialNumberGetallReader is a Reader for the PcloudCloudinstancesVirtualSerialNumberGetall structure. +type PcloudCloudinstancesVirtualSerialNumberGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesVirtualSerialNumberGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudinstancesVirtualSerialNumberGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesVirtualSerialNumberGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesVirtualSerialNumberGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudCloudinstancesVirtualSerialNumberGetallForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudCloudinstancesVirtualSerialNumberGetallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesVirtualSerialNumberGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/virtual-serial-number] pcloud.cloudinstances.virtual-serial-number.getall", response, response.Code()) + } +} + +// NewPcloudCloudinstancesVirtualSerialNumberGetallOK creates a PcloudCloudinstancesVirtualSerialNumberGetallOK with default headers values +func NewPcloudCloudinstancesVirtualSerialNumberGetallOK() *PcloudCloudinstancesVirtualSerialNumberGetallOK { + return &PcloudCloudinstancesVirtualSerialNumberGetallOK{} +} + +/* +PcloudCloudinstancesVirtualSerialNumberGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudinstancesVirtualSerialNumberGetallOK struct { + Payload models.VirtualSerialNumberList +} + +// IsSuccess returns true when this pcloud cloudinstances virtual serial number getall o k response has a 2xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this pcloud cloudinstances virtual serial number getall o k response has a 3xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud cloudinstances virtual serial number getall o k response has a 4xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud cloudinstances virtual serial number getall o k response has a 5xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallOK) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud cloudinstances virtual serial number getall o k response a status code equal to that given +func (o *PcloudCloudinstancesVirtualSerialNumberGetallOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the pcloud cloudinstances virtual serial number getall o k response +func (o *PcloudCloudinstancesVirtualSerialNumberGetallOK) Code() int { + return 200 +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/virtual-serial-number][%d] pcloudCloudinstancesVirtualSerialNumberGetallOK %s", 200, payload) +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/virtual-serial-number][%d] pcloudCloudinstancesVirtualSerialNumberGetallOK %s", 200, payload) +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallOK) GetPayload() models.VirtualSerialNumberList { + return o.Payload +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallOK) 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 +} + +// NewPcloudCloudinstancesVirtualSerialNumberGetallBadRequest creates a PcloudCloudinstancesVirtualSerialNumberGetallBadRequest with default headers values +func NewPcloudCloudinstancesVirtualSerialNumberGetallBadRequest() *PcloudCloudinstancesVirtualSerialNumberGetallBadRequest { + return &PcloudCloudinstancesVirtualSerialNumberGetallBadRequest{} +} + +/* +PcloudCloudinstancesVirtualSerialNumberGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesVirtualSerialNumberGetallBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud cloudinstances virtual serial number getall bad request response has a 2xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud cloudinstances virtual serial number getall bad request response has a 3xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud cloudinstances virtual serial number getall bad request response has a 4xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud cloudinstances virtual serial number getall bad request response has a 5xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud cloudinstances virtual serial number getall bad request response a status code equal to that given +func (o *PcloudCloudinstancesVirtualSerialNumberGetallBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the pcloud cloudinstances virtual serial number getall bad request response +func (o *PcloudCloudinstancesVirtualSerialNumberGetallBadRequest) Code() int { + return 400 +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/virtual-serial-number][%d] pcloudCloudinstancesVirtualSerialNumberGetallBadRequest %s", 400, payload) +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/virtual-serial-number][%d] pcloudCloudinstancesVirtualSerialNumberGetallBadRequest %s", 400, payload) +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallBadRequest) 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 +} + +// NewPcloudCloudinstancesVirtualSerialNumberGetallUnauthorized creates a PcloudCloudinstancesVirtualSerialNumberGetallUnauthorized with default headers values +func NewPcloudCloudinstancesVirtualSerialNumberGetallUnauthorized() *PcloudCloudinstancesVirtualSerialNumberGetallUnauthorized { + return &PcloudCloudinstancesVirtualSerialNumberGetallUnauthorized{} +} + +/* +PcloudCloudinstancesVirtualSerialNumberGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesVirtualSerialNumberGetallUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud cloudinstances virtual serial number getall unauthorized response has a 2xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud cloudinstances virtual serial number getall unauthorized response has a 3xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud cloudinstances virtual serial number getall unauthorized response has a 4xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud cloudinstances virtual serial number getall unauthorized response has a 5xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud cloudinstances virtual serial number getall unauthorized response a status code equal to that given +func (o *PcloudCloudinstancesVirtualSerialNumberGetallUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the pcloud cloudinstances virtual serial number getall unauthorized response +func (o *PcloudCloudinstancesVirtualSerialNumberGetallUnauthorized) Code() int { + return 401 +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/virtual-serial-number][%d] pcloudCloudinstancesVirtualSerialNumberGetallUnauthorized %s", 401, payload) +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/virtual-serial-number][%d] pcloudCloudinstancesVirtualSerialNumberGetallUnauthorized %s", 401, payload) +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallUnauthorized) 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 +} + +// NewPcloudCloudinstancesVirtualSerialNumberGetallForbidden creates a PcloudCloudinstancesVirtualSerialNumberGetallForbidden with default headers values +func NewPcloudCloudinstancesVirtualSerialNumberGetallForbidden() *PcloudCloudinstancesVirtualSerialNumberGetallForbidden { + return &PcloudCloudinstancesVirtualSerialNumberGetallForbidden{} +} + +/* +PcloudCloudinstancesVirtualSerialNumberGetallForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudCloudinstancesVirtualSerialNumberGetallForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud cloudinstances virtual serial number getall forbidden response has a 2xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud cloudinstances virtual serial number getall forbidden response has a 3xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud cloudinstances virtual serial number getall forbidden response has a 4xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud cloudinstances virtual serial number getall forbidden response has a 5xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud cloudinstances virtual serial number getall forbidden response a status code equal to that given +func (o *PcloudCloudinstancesVirtualSerialNumberGetallForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the pcloud cloudinstances virtual serial number getall forbidden response +func (o *PcloudCloudinstancesVirtualSerialNumberGetallForbidden) Code() int { + return 403 +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/virtual-serial-number][%d] pcloudCloudinstancesVirtualSerialNumberGetallForbidden %s", 403, payload) +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/virtual-serial-number][%d] pcloudCloudinstancesVirtualSerialNumberGetallForbidden %s", 403, payload) +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallForbidden) 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 +} + +// NewPcloudCloudinstancesVirtualSerialNumberGetallNotFound creates a PcloudCloudinstancesVirtualSerialNumberGetallNotFound with default headers values +func NewPcloudCloudinstancesVirtualSerialNumberGetallNotFound() *PcloudCloudinstancesVirtualSerialNumberGetallNotFound { + return &PcloudCloudinstancesVirtualSerialNumberGetallNotFound{} +} + +/* +PcloudCloudinstancesVirtualSerialNumberGetallNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudCloudinstancesVirtualSerialNumberGetallNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud cloudinstances virtual serial number getall not found response has a 2xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud cloudinstances virtual serial number getall not found response has a 3xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud cloudinstances virtual serial number getall not found response has a 4xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud cloudinstances virtual serial number getall not found response has a 5xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud cloudinstances virtual serial number getall not found response a status code equal to that given +func (o *PcloudCloudinstancesVirtualSerialNumberGetallNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the pcloud cloudinstances virtual serial number getall not found response +func (o *PcloudCloudinstancesVirtualSerialNumberGetallNotFound) Code() int { + return 404 +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/virtual-serial-number][%d] pcloudCloudinstancesVirtualSerialNumberGetallNotFound %s", 404, payload) +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/virtual-serial-number][%d] pcloudCloudinstancesVirtualSerialNumberGetallNotFound %s", 404, payload) +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallNotFound) 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 +} + +// NewPcloudCloudinstancesVirtualSerialNumberGetallInternalServerError creates a PcloudCloudinstancesVirtualSerialNumberGetallInternalServerError with default headers values +func NewPcloudCloudinstancesVirtualSerialNumberGetallInternalServerError() *PcloudCloudinstancesVirtualSerialNumberGetallInternalServerError { + return &PcloudCloudinstancesVirtualSerialNumberGetallInternalServerError{} +} + +/* +PcloudCloudinstancesVirtualSerialNumberGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesVirtualSerialNumberGetallInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud cloudinstances virtual serial number getall internal server error response has a 2xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud cloudinstances virtual serial number getall internal server error response has a 3xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud cloudinstances virtual serial number getall internal server error response has a 4xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud cloudinstances virtual serial number getall internal server error response has a 5xx status code +func (o *PcloudCloudinstancesVirtualSerialNumberGetallInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this pcloud cloudinstances virtual serial number getall internal server error response a status code equal to that given +func (o *PcloudCloudinstancesVirtualSerialNumberGetallInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the pcloud cloudinstances virtual serial number getall internal server error response +func (o *PcloudCloudinstancesVirtualSerialNumberGetallInternalServerError) Code() int { + return 500 +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/virtual-serial-number][%d] pcloudCloudinstancesVirtualSerialNumberGetallInternalServerError %s", 500, payload) +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/virtual-serial-number][%d] pcloudCloudinstancesVirtualSerialNumberGetallInternalServerError %s", 500, payload) +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVirtualSerialNumberGetallInternalServerError) 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/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_delete_parameters.go b/power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_delete_parameters.go new file mode 100644 index 00000000..12f21bf2 --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_delete_parameters.go @@ -0,0 +1,197 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_virtual_serial_number + +// 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" +) + +// NewPcloudPvminstancesVirtualserialnumberDeleteParams creates a new PcloudPvminstancesVirtualserialnumberDeleteParams 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 NewPcloudPvminstancesVirtualserialnumberDeleteParams() *PcloudPvminstancesVirtualserialnumberDeleteParams { + return &PcloudPvminstancesVirtualserialnumberDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesVirtualserialnumberDeleteParamsWithTimeout creates a new PcloudPvminstancesVirtualserialnumberDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesVirtualserialnumberDeleteParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesVirtualserialnumberDeleteParams { + return &PcloudPvminstancesVirtualserialnumberDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesVirtualserialnumberDeleteParamsWithContext creates a new PcloudPvminstancesVirtualserialnumberDeleteParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesVirtualserialnumberDeleteParamsWithContext(ctx context.Context) *PcloudPvminstancesVirtualserialnumberDeleteParams { + return &PcloudPvminstancesVirtualserialnumberDeleteParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesVirtualserialnumberDeleteParamsWithHTTPClient creates a new PcloudPvminstancesVirtualserialnumberDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesVirtualserialnumberDeleteParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesVirtualserialnumberDeleteParams { + return &PcloudPvminstancesVirtualserialnumberDeleteParams{ + HTTPClient: client, + } +} + +/* +PcloudPvminstancesVirtualserialnumberDeleteParams contains all the parameters to send to the API endpoint + + for the pcloud pvminstances virtualserialnumber delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesVirtualserialnumberDeleteParams struct { + + /* Body. + + Parameters to unassign a Virtual Serial Number attached to a PVM Instance + */ + Body *models.DeleteServerVirtualSerialNumber + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances virtualserialnumber delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVirtualserialnumberDeleteParams) WithDefaults() *PcloudPvminstancesVirtualserialnumberDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances virtualserialnumber delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVirtualserialnumberDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances virtualserialnumber delete params +func (o *PcloudPvminstancesVirtualserialnumberDeleteParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesVirtualserialnumberDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances virtualserialnumber delete params +func (o *PcloudPvminstancesVirtualserialnumberDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances virtualserialnumber delete params +func (o *PcloudPvminstancesVirtualserialnumberDeleteParams) WithContext(ctx context.Context) *PcloudPvminstancesVirtualserialnumberDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances virtualserialnumber delete params +func (o *PcloudPvminstancesVirtualserialnumberDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances virtualserialnumber delete params +func (o *PcloudPvminstancesVirtualserialnumberDeleteParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesVirtualserialnumberDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances virtualserialnumber delete params +func (o *PcloudPvminstancesVirtualserialnumberDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud pvminstances virtualserialnumber delete params +func (o *PcloudPvminstancesVirtualserialnumberDeleteParams) WithBody(body *models.DeleteServerVirtualSerialNumber) *PcloudPvminstancesVirtualserialnumberDeleteParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud pvminstances virtualserialnumber delete params +func (o *PcloudPvminstancesVirtualserialnumberDeleteParams) SetBody(body *models.DeleteServerVirtualSerialNumber) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances virtualserialnumber delete params +func (o *PcloudPvminstancesVirtualserialnumberDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesVirtualserialnumberDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances virtualserialnumber delete params +func (o *PcloudPvminstancesVirtualserialnumberDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances virtualserialnumber delete params +func (o *PcloudPvminstancesVirtualserialnumberDeleteParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesVirtualserialnumberDeleteParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances virtualserialnumber delete params +func (o *PcloudPvminstancesVirtualserialnumberDeleteParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesVirtualserialnumberDeleteParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_delete_responses.go b/power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_delete_responses.go new file mode 100644 index 00000000..320b74c6 --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_delete_responses.go @@ -0,0 +1,560 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_virtual_serial_number + +// 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" +) + +// PcloudPvminstancesVirtualserialnumberDeleteReader is a Reader for the PcloudPvminstancesVirtualserialnumberDelete structure. +type PcloudPvminstancesVirtualserialnumberDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesVirtualserialnumberDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudPvminstancesVirtualserialnumberDeleteAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesVirtualserialnumberDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesVirtualserialnumberDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudPvminstancesVirtualserialnumberDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudPvminstancesVirtualserialnumberDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 410: + result := NewPcloudPvminstancesVirtualserialnumberDeleteGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesVirtualserialnumberDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number] pcloud.pvminstances.virtualserialnumber.delete", response, response.Code()) + } +} + +// NewPcloudPvminstancesVirtualserialnumberDeleteAccepted creates a PcloudPvminstancesVirtualserialnumberDeleteAccepted with default headers values +func NewPcloudPvminstancesVirtualserialnumberDeleteAccepted() *PcloudPvminstancesVirtualserialnumberDeleteAccepted { + return &PcloudPvminstancesVirtualserialnumberDeleteAccepted{} +} + +/* +PcloudPvminstancesVirtualserialnumberDeleteAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudPvminstancesVirtualserialnumberDeleteAccepted struct { + Payload models.Object +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber delete accepted response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteAccepted) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber delete accepted response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteAccepted) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber delete accepted response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteAccepted) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber delete accepted response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteAccepted) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber delete accepted response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberDeleteAccepted) IsCode(code int) bool { + return code == 202 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber delete accepted response +func (o *PcloudPvminstancesVirtualserialnumberDeleteAccepted) Code() int { + return 202 +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteAccepted) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberDeleteAccepted %s", 202, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteAccepted) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberDeleteAccepted %s", 202, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteAccepted) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteAccepted) 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 +} + +// NewPcloudPvminstancesVirtualserialnumberDeleteBadRequest creates a PcloudPvminstancesVirtualserialnumberDeleteBadRequest with default headers values +func NewPcloudPvminstancesVirtualserialnumberDeleteBadRequest() *PcloudPvminstancesVirtualserialnumberDeleteBadRequest { + return &PcloudPvminstancesVirtualserialnumberDeleteBadRequest{} +} + +/* +PcloudPvminstancesVirtualserialnumberDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesVirtualserialnumberDeleteBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber delete bad request response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber delete bad request response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber delete bad request response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber delete bad request response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber delete bad request response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber delete bad request response +func (o *PcloudPvminstancesVirtualserialnumberDeleteBadRequest) Code() int { + return 400 +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberDeleteBadRequest %s", 400, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberDeleteBadRequest %s", 400, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteBadRequest) 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 +} + +// NewPcloudPvminstancesVirtualserialnumberDeleteUnauthorized creates a PcloudPvminstancesVirtualserialnumberDeleteUnauthorized with default headers values +func NewPcloudPvminstancesVirtualserialnumberDeleteUnauthorized() *PcloudPvminstancesVirtualserialnumberDeleteUnauthorized { + return &PcloudPvminstancesVirtualserialnumberDeleteUnauthorized{} +} + +/* +PcloudPvminstancesVirtualserialnumberDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesVirtualserialnumberDeleteUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber delete unauthorized response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber delete unauthorized response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber delete unauthorized response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber delete unauthorized response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber delete unauthorized response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber delete unauthorized response +func (o *PcloudPvminstancesVirtualserialnumberDeleteUnauthorized) Code() int { + return 401 +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberDeleteUnauthorized %s", 401, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberDeleteUnauthorized %s", 401, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteUnauthorized) 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 +} + +// NewPcloudPvminstancesVirtualserialnumberDeleteForbidden creates a PcloudPvminstancesVirtualserialnumberDeleteForbidden with default headers values +func NewPcloudPvminstancesVirtualserialnumberDeleteForbidden() *PcloudPvminstancesVirtualserialnumberDeleteForbidden { + return &PcloudPvminstancesVirtualserialnumberDeleteForbidden{} +} + +/* +PcloudPvminstancesVirtualserialnumberDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudPvminstancesVirtualserialnumberDeleteForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber delete forbidden response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber delete forbidden response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber delete forbidden response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber delete forbidden response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber delete forbidden response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber delete forbidden response +func (o *PcloudPvminstancesVirtualserialnumberDeleteForbidden) Code() int { + return 403 +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberDeleteForbidden %s", 403, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberDeleteForbidden %s", 403, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteForbidden) 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 +} + +// NewPcloudPvminstancesVirtualserialnumberDeleteNotFound creates a PcloudPvminstancesVirtualserialnumberDeleteNotFound with default headers values +func NewPcloudPvminstancesVirtualserialnumberDeleteNotFound() *PcloudPvminstancesVirtualserialnumberDeleteNotFound { + return &PcloudPvminstancesVirtualserialnumberDeleteNotFound{} +} + +/* +PcloudPvminstancesVirtualserialnumberDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPvminstancesVirtualserialnumberDeleteNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber delete not found response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber delete not found response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber delete not found response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber delete not found response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber delete not found response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber delete not found response +func (o *PcloudPvminstancesVirtualserialnumberDeleteNotFound) Code() int { + return 404 +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberDeleteNotFound %s", 404, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberDeleteNotFound %s", 404, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteNotFound) 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 +} + +// NewPcloudPvminstancesVirtualserialnumberDeleteGone creates a PcloudPvminstancesVirtualserialnumberDeleteGone with default headers values +func NewPcloudPvminstancesVirtualserialnumberDeleteGone() *PcloudPvminstancesVirtualserialnumberDeleteGone { + return &PcloudPvminstancesVirtualserialnumberDeleteGone{} +} + +/* +PcloudPvminstancesVirtualserialnumberDeleteGone describes a response with status code 410, with default header values. + +Gone +*/ +type PcloudPvminstancesVirtualserialnumberDeleteGone struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber delete gone response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteGone) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber delete gone response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteGone) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber delete gone response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteGone) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber delete gone response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteGone) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber delete gone response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberDeleteGone) IsCode(code int) bool { + return code == 410 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber delete gone response +func (o *PcloudPvminstancesVirtualserialnumberDeleteGone) Code() int { + return 410 +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteGone) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberDeleteGone %s", 410, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteGone) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberDeleteGone %s", 410, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteGone) 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 +} + +// NewPcloudPvminstancesVirtualserialnumberDeleteInternalServerError creates a PcloudPvminstancesVirtualserialnumberDeleteInternalServerError with default headers values +func NewPcloudPvminstancesVirtualserialnumberDeleteInternalServerError() *PcloudPvminstancesVirtualserialnumberDeleteInternalServerError { + return &PcloudPvminstancesVirtualserialnumberDeleteInternalServerError{} +} + +/* +PcloudPvminstancesVirtualserialnumberDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesVirtualserialnumberDeleteInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber delete internal server error response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber delete internal server error response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber delete internal server error response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber delete internal server error response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber delete internal server error response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber delete internal server error response +func (o *PcloudPvminstancesVirtualserialnumberDeleteInternalServerError) Code() int { + return 500 +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberDeleteInternalServerError %s", 500, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberDeleteInternalServerError %s", 500, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteInternalServerError) 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/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_get_parameters.go b/power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_get_parameters.go new file mode 100644 index 00000000..adf61cda --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_get_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_virtual_serial_number + +// 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" +) + +// NewPcloudPvminstancesVirtualserialnumberGetParams creates a new PcloudPvminstancesVirtualserialnumberGetParams 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 NewPcloudPvminstancesVirtualserialnumberGetParams() *PcloudPvminstancesVirtualserialnumberGetParams { + return &PcloudPvminstancesVirtualserialnumberGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesVirtualserialnumberGetParamsWithTimeout creates a new PcloudPvminstancesVirtualserialnumberGetParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesVirtualserialnumberGetParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesVirtualserialnumberGetParams { + return &PcloudPvminstancesVirtualserialnumberGetParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesVirtualserialnumberGetParamsWithContext creates a new PcloudPvminstancesVirtualserialnumberGetParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesVirtualserialnumberGetParamsWithContext(ctx context.Context) *PcloudPvminstancesVirtualserialnumberGetParams { + return &PcloudPvminstancesVirtualserialnumberGetParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesVirtualserialnumberGetParamsWithHTTPClient creates a new PcloudPvminstancesVirtualserialnumberGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesVirtualserialnumberGetParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesVirtualserialnumberGetParams { + return &PcloudPvminstancesVirtualserialnumberGetParams{ + HTTPClient: client, + } +} + +/* +PcloudPvminstancesVirtualserialnumberGetParams contains all the parameters to send to the API endpoint + + for the pcloud pvminstances virtualserialnumber get operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesVirtualserialnumberGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances virtualserialnumber get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVirtualserialnumberGetParams) WithDefaults() *PcloudPvminstancesVirtualserialnumberGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances virtualserialnumber get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVirtualserialnumberGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances virtualserialnumber get params +func (o *PcloudPvminstancesVirtualserialnumberGetParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesVirtualserialnumberGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances virtualserialnumber get params +func (o *PcloudPvminstancesVirtualserialnumberGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances virtualserialnumber get params +func (o *PcloudPvminstancesVirtualserialnumberGetParams) WithContext(ctx context.Context) *PcloudPvminstancesVirtualserialnumberGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances virtualserialnumber get params +func (o *PcloudPvminstancesVirtualserialnumberGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances virtualserialnumber get params +func (o *PcloudPvminstancesVirtualserialnumberGetParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesVirtualserialnumberGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances virtualserialnumber get params +func (o *PcloudPvminstancesVirtualserialnumberGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances virtualserialnumber get params +func (o *PcloudPvminstancesVirtualserialnumberGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesVirtualserialnumberGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances virtualserialnumber get params +func (o *PcloudPvminstancesVirtualserialnumberGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances virtualserialnumber get params +func (o *PcloudPvminstancesVirtualserialnumberGetParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesVirtualserialnumberGetParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances virtualserialnumber get params +func (o *PcloudPvminstancesVirtualserialnumberGetParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesVirtualserialnumberGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_get_responses.go b/power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_get_responses.go new file mode 100644 index 00000000..e9f85fbe --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_get_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_virtual_serial_number + +// 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" +) + +// PcloudPvminstancesVirtualserialnumberGetReader is a Reader for the PcloudPvminstancesVirtualserialnumberGet structure. +type PcloudPvminstancesVirtualserialnumberGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesVirtualserialnumberGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPvminstancesVirtualserialnumberGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesVirtualserialnumberGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesVirtualserialnumberGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudPvminstancesVirtualserialnumberGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudPvminstancesVirtualserialnumberGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesVirtualserialnumberGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number] pcloud.pvminstances.virtualserialnumber.get", response, response.Code()) + } +} + +// NewPcloudPvminstancesVirtualserialnumberGetOK creates a PcloudPvminstancesVirtualserialnumberGetOK with default headers values +func NewPcloudPvminstancesVirtualserialnumberGetOK() *PcloudPvminstancesVirtualserialnumberGetOK { + return &PcloudPvminstancesVirtualserialnumberGetOK{} +} + +/* +PcloudPvminstancesVirtualserialnumberGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPvminstancesVirtualserialnumberGetOK struct { + Payload *models.VirtualSerialNumber +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber get o k response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber get o k response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber get o k response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber get o k response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber get o k response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber get o k response +func (o *PcloudPvminstancesVirtualserialnumberGetOK) Code() int { + return 200 +} + +func (o *PcloudPvminstancesVirtualserialnumberGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberGetOK %s", 200, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberGetOK %s", 200, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberGetOK) GetPayload() *models.VirtualSerialNumber { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.VirtualSerialNumber) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPvminstancesVirtualserialnumberGetBadRequest creates a PcloudPvminstancesVirtualserialnumberGetBadRequest with default headers values +func NewPcloudPvminstancesVirtualserialnumberGetBadRequest() *PcloudPvminstancesVirtualserialnumberGetBadRequest { + return &PcloudPvminstancesVirtualserialnumberGetBadRequest{} +} + +/* +PcloudPvminstancesVirtualserialnumberGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesVirtualserialnumberGetBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber get bad request response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber get bad request response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber get bad request response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber get bad request response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber get bad request response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber get bad request response +func (o *PcloudPvminstancesVirtualserialnumberGetBadRequest) Code() int { + return 400 +} + +func (o *PcloudPvminstancesVirtualserialnumberGetBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberGetBadRequest %s", 400, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberGetBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberGetBadRequest %s", 400, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberGetBadRequest) 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 +} + +// NewPcloudPvminstancesVirtualserialnumberGetUnauthorized creates a PcloudPvminstancesVirtualserialnumberGetUnauthorized with default headers values +func NewPcloudPvminstancesVirtualserialnumberGetUnauthorized() *PcloudPvminstancesVirtualserialnumberGetUnauthorized { + return &PcloudPvminstancesVirtualserialnumberGetUnauthorized{} +} + +/* +PcloudPvminstancesVirtualserialnumberGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesVirtualserialnumberGetUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber get unauthorized response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber get unauthorized response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber get unauthorized response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber get unauthorized response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber get unauthorized response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber get unauthorized response +func (o *PcloudPvminstancesVirtualserialnumberGetUnauthorized) Code() int { + return 401 +} + +func (o *PcloudPvminstancesVirtualserialnumberGetUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberGetUnauthorized %s", 401, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberGetUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberGetUnauthorized %s", 401, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberGetUnauthorized) 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 +} + +// NewPcloudPvminstancesVirtualserialnumberGetForbidden creates a PcloudPvminstancesVirtualserialnumberGetForbidden with default headers values +func NewPcloudPvminstancesVirtualserialnumberGetForbidden() *PcloudPvminstancesVirtualserialnumberGetForbidden { + return &PcloudPvminstancesVirtualserialnumberGetForbidden{} +} + +/* +PcloudPvminstancesVirtualserialnumberGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudPvminstancesVirtualserialnumberGetForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber get forbidden response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber get forbidden response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber get forbidden response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber get forbidden response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber get forbidden response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber get forbidden response +func (o *PcloudPvminstancesVirtualserialnumberGetForbidden) Code() int { + return 403 +} + +func (o *PcloudPvminstancesVirtualserialnumberGetForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberGetForbidden %s", 403, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberGetForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberGetForbidden %s", 403, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberGetForbidden) 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 +} + +// NewPcloudPvminstancesVirtualserialnumberGetNotFound creates a PcloudPvminstancesVirtualserialnumberGetNotFound with default headers values +func NewPcloudPvminstancesVirtualserialnumberGetNotFound() *PcloudPvminstancesVirtualserialnumberGetNotFound { + return &PcloudPvminstancesVirtualserialnumberGetNotFound{} +} + +/* +PcloudPvminstancesVirtualserialnumberGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPvminstancesVirtualserialnumberGetNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber get not found response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber get not found response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber get not found response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber get not found response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber get not found response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber get not found response +func (o *PcloudPvminstancesVirtualserialnumberGetNotFound) Code() int { + return 404 +} + +func (o *PcloudPvminstancesVirtualserialnumberGetNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberGetNotFound %s", 404, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberGetNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberGetNotFound %s", 404, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberGetNotFound) 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 +} + +// NewPcloudPvminstancesVirtualserialnumberGetInternalServerError creates a PcloudPvminstancesVirtualserialnumberGetInternalServerError with default headers values +func NewPcloudPvminstancesVirtualserialnumberGetInternalServerError() *PcloudPvminstancesVirtualserialnumberGetInternalServerError { + return &PcloudPvminstancesVirtualserialnumberGetInternalServerError{} +} + +/* +PcloudPvminstancesVirtualserialnumberGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesVirtualserialnumberGetInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber get internal server error response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber get internal server error response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber get internal server error response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber get internal server error response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber get internal server error response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber get internal server error response +func (o *PcloudPvminstancesVirtualserialnumberGetInternalServerError) Code() int { + return 500 +} + +func (o *PcloudPvminstancesVirtualserialnumberGetInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberGetInternalServerError %s", 500, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberGetInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberGetInternalServerError %s", 500, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberGetInternalServerError) 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/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_post_parameters.go b/power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_post_parameters.go new file mode 100644 index 00000000..b155d081 --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_post_parameters.go @@ -0,0 +1,197 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_virtual_serial_number + +// 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" +) + +// NewPcloudPvminstancesVirtualserialnumberPostParams creates a new PcloudPvminstancesVirtualserialnumberPostParams 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 NewPcloudPvminstancesVirtualserialnumberPostParams() *PcloudPvminstancesVirtualserialnumberPostParams { + return &PcloudPvminstancesVirtualserialnumberPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesVirtualserialnumberPostParamsWithTimeout creates a new PcloudPvminstancesVirtualserialnumberPostParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesVirtualserialnumberPostParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesVirtualserialnumberPostParams { + return &PcloudPvminstancesVirtualserialnumberPostParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesVirtualserialnumberPostParamsWithContext creates a new PcloudPvminstancesVirtualserialnumberPostParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesVirtualserialnumberPostParamsWithContext(ctx context.Context) *PcloudPvminstancesVirtualserialnumberPostParams { + return &PcloudPvminstancesVirtualserialnumberPostParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesVirtualserialnumberPostParamsWithHTTPClient creates a new PcloudPvminstancesVirtualserialnumberPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesVirtualserialnumberPostParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesVirtualserialnumberPostParams { + return &PcloudPvminstancesVirtualserialnumberPostParams{ + HTTPClient: client, + } +} + +/* +PcloudPvminstancesVirtualserialnumberPostParams contains all the parameters to send to the API endpoint + + for the pcloud pvminstances virtualserialnumber post operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesVirtualserialnumberPostParams struct { + + /* Body. + + Parameters to assign Virtual Serial Number to a PVM Instance + */ + Body *models.AddServerVirtualSerialNumber + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances virtualserialnumber post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVirtualserialnumberPostParams) WithDefaults() *PcloudPvminstancesVirtualserialnumberPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances virtualserialnumber post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVirtualserialnumberPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances virtualserialnumber post params +func (o *PcloudPvminstancesVirtualserialnumberPostParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesVirtualserialnumberPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances virtualserialnumber post params +func (o *PcloudPvminstancesVirtualserialnumberPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances virtualserialnumber post params +func (o *PcloudPvminstancesVirtualserialnumberPostParams) WithContext(ctx context.Context) *PcloudPvminstancesVirtualserialnumberPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances virtualserialnumber post params +func (o *PcloudPvminstancesVirtualserialnumberPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances virtualserialnumber post params +func (o *PcloudPvminstancesVirtualserialnumberPostParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesVirtualserialnumberPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances virtualserialnumber post params +func (o *PcloudPvminstancesVirtualserialnumberPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud pvminstances virtualserialnumber post params +func (o *PcloudPvminstancesVirtualserialnumberPostParams) WithBody(body *models.AddServerVirtualSerialNumber) *PcloudPvminstancesVirtualserialnumberPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud pvminstances virtualserialnumber post params +func (o *PcloudPvminstancesVirtualserialnumberPostParams) SetBody(body *models.AddServerVirtualSerialNumber) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances virtualserialnumber post params +func (o *PcloudPvminstancesVirtualserialnumberPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesVirtualserialnumberPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances virtualserialnumber post params +func (o *PcloudPvminstancesVirtualserialnumberPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances virtualserialnumber post params +func (o *PcloudPvminstancesVirtualserialnumberPostParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesVirtualserialnumberPostParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances virtualserialnumber post params +func (o *PcloudPvminstancesVirtualserialnumberPostParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesVirtualserialnumberPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_post_responses.go b/power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_post_responses.go new file mode 100644 index 00000000..8a7516dd --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_post_responses.go @@ -0,0 +1,638 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_virtual_serial_number + +// 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" +) + +// PcloudPvminstancesVirtualserialnumberPostReader is a Reader for the PcloudPvminstancesVirtualserialnumberPost structure. +type PcloudPvminstancesVirtualserialnumberPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesVirtualserialnumberPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudPvminstancesVirtualserialnumberPostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesVirtualserialnumberPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesVirtualserialnumberPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudPvminstancesVirtualserialnumberPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudPvminstancesVirtualserialnumberPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudPvminstancesVirtualserialnumberPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesVirtualserialnumberPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 504: + result := NewPcloudPvminstancesVirtualserialnumberPostGatewayTimeout() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number] pcloud.pvminstances.virtualserialnumber.post", response, response.Code()) + } +} + +// NewPcloudPvminstancesVirtualserialnumberPostAccepted creates a PcloudPvminstancesVirtualserialnumberPostAccepted with default headers values +func NewPcloudPvminstancesVirtualserialnumberPostAccepted() *PcloudPvminstancesVirtualserialnumberPostAccepted { + return &PcloudPvminstancesVirtualserialnumberPostAccepted{} +} + +/* +PcloudPvminstancesVirtualserialnumberPostAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudPvminstancesVirtualserialnumberPostAccepted struct { + Payload *models.VirtualSerialNumber +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber post accepted response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostAccepted) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber post accepted response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostAccepted) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber post accepted response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostAccepted) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber post accepted response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostAccepted) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber post accepted response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberPostAccepted) IsCode(code int) bool { + return code == 202 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber post accepted response +func (o *PcloudPvminstancesVirtualserialnumberPostAccepted) Code() int { + return 202 +} + +func (o *PcloudPvminstancesVirtualserialnumberPostAccepted) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPostAccepted %s", 202, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPostAccepted) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPostAccepted %s", 202, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPostAccepted) GetPayload() *models.VirtualSerialNumber { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.VirtualSerialNumber) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPvminstancesVirtualserialnumberPostBadRequest creates a PcloudPvminstancesVirtualserialnumberPostBadRequest with default headers values +func NewPcloudPvminstancesVirtualserialnumberPostBadRequest() *PcloudPvminstancesVirtualserialnumberPostBadRequest { + return &PcloudPvminstancesVirtualserialnumberPostBadRequest{} +} + +/* +PcloudPvminstancesVirtualserialnumberPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesVirtualserialnumberPostBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber post bad request response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber post bad request response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber post bad request response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber post bad request response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber post bad request response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber post bad request response +func (o *PcloudPvminstancesVirtualserialnumberPostBadRequest) Code() int { + return 400 +} + +func (o *PcloudPvminstancesVirtualserialnumberPostBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPostBadRequest %s", 400, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPostBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPostBadRequest %s", 400, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberPostBadRequest) 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 +} + +// NewPcloudPvminstancesVirtualserialnumberPostUnauthorized creates a PcloudPvminstancesVirtualserialnumberPostUnauthorized with default headers values +func NewPcloudPvminstancesVirtualserialnumberPostUnauthorized() *PcloudPvminstancesVirtualserialnumberPostUnauthorized { + return &PcloudPvminstancesVirtualserialnumberPostUnauthorized{} +} + +/* +PcloudPvminstancesVirtualserialnumberPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesVirtualserialnumberPostUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber post unauthorized response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber post unauthorized response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber post unauthorized response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber post unauthorized response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber post unauthorized response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber post unauthorized response +func (o *PcloudPvminstancesVirtualserialnumberPostUnauthorized) Code() int { + return 401 +} + +func (o *PcloudPvminstancesVirtualserialnumberPostUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPostUnauthorized %s", 401, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPostUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPostUnauthorized %s", 401, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberPostUnauthorized) 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 +} + +// NewPcloudPvminstancesVirtualserialnumberPostForbidden creates a PcloudPvminstancesVirtualserialnumberPostForbidden with default headers values +func NewPcloudPvminstancesVirtualserialnumberPostForbidden() *PcloudPvminstancesVirtualserialnumberPostForbidden { + return &PcloudPvminstancesVirtualserialnumberPostForbidden{} +} + +/* +PcloudPvminstancesVirtualserialnumberPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudPvminstancesVirtualserialnumberPostForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber post forbidden response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber post forbidden response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber post forbidden response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber post forbidden response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber post forbidden response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber post forbidden response +func (o *PcloudPvminstancesVirtualserialnumberPostForbidden) Code() int { + return 403 +} + +func (o *PcloudPvminstancesVirtualserialnumberPostForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPostForbidden %s", 403, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPostForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPostForbidden %s", 403, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberPostForbidden) 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 +} + +// NewPcloudPvminstancesVirtualserialnumberPostNotFound creates a PcloudPvminstancesVirtualserialnumberPostNotFound with default headers values +func NewPcloudPvminstancesVirtualserialnumberPostNotFound() *PcloudPvminstancesVirtualserialnumberPostNotFound { + return &PcloudPvminstancesVirtualserialnumberPostNotFound{} +} + +/* +PcloudPvminstancesVirtualserialnumberPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPvminstancesVirtualserialnumberPostNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber post not found response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber post not found response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber post not found response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber post not found response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber post not found response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberPostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber post not found response +func (o *PcloudPvminstancesVirtualserialnumberPostNotFound) Code() int { + return 404 +} + +func (o *PcloudPvminstancesVirtualserialnumberPostNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPostNotFound %s", 404, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPostNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPostNotFound %s", 404, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberPostNotFound) 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 +} + +// NewPcloudPvminstancesVirtualserialnumberPostConflict creates a PcloudPvminstancesVirtualserialnumberPostConflict with default headers values +func NewPcloudPvminstancesVirtualserialnumberPostConflict() *PcloudPvminstancesVirtualserialnumberPostConflict { + return &PcloudPvminstancesVirtualserialnumberPostConflict{} +} + +/* +PcloudPvminstancesVirtualserialnumberPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudPvminstancesVirtualserialnumberPostConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber post conflict response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber post conflict response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber post conflict response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber post conflict response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber post conflict response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber post conflict response +func (o *PcloudPvminstancesVirtualserialnumberPostConflict) Code() int { + return 409 +} + +func (o *PcloudPvminstancesVirtualserialnumberPostConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPostConflict %s", 409, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPostConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPostConflict %s", 409, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberPostConflict) 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 +} + +// NewPcloudPvminstancesVirtualserialnumberPostInternalServerError creates a PcloudPvminstancesVirtualserialnumberPostInternalServerError with default headers values +func NewPcloudPvminstancesVirtualserialnumberPostInternalServerError() *PcloudPvminstancesVirtualserialnumberPostInternalServerError { + return &PcloudPvminstancesVirtualserialnumberPostInternalServerError{} +} + +/* +PcloudPvminstancesVirtualserialnumberPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesVirtualserialnumberPostInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber post internal server error response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber post internal server error response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber post internal server error response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber post internal server error response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber post internal server error response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber post internal server error response +func (o *PcloudPvminstancesVirtualserialnumberPostInternalServerError) Code() int { + return 500 +} + +func (o *PcloudPvminstancesVirtualserialnumberPostInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPostInternalServerError %s", 500, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPostInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPostInternalServerError %s", 500, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberPostInternalServerError) 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 +} + +// NewPcloudPvminstancesVirtualserialnumberPostGatewayTimeout creates a PcloudPvminstancesVirtualserialnumberPostGatewayTimeout with default headers values +func NewPcloudPvminstancesVirtualserialnumberPostGatewayTimeout() *PcloudPvminstancesVirtualserialnumberPostGatewayTimeout { + return &PcloudPvminstancesVirtualserialnumberPostGatewayTimeout{} +} + +/* +PcloudPvminstancesVirtualserialnumberPostGatewayTimeout describes a response with status code 504, with default header values. + +Gateway Timeout +*/ +type PcloudPvminstancesVirtualserialnumberPostGatewayTimeout struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber post gateway timeout response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostGatewayTimeout) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber post gateway timeout response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostGatewayTimeout) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber post gateway timeout response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostGatewayTimeout) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber post gateway timeout response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberPostGatewayTimeout) IsServerError() bool { + return true +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber post gateway timeout response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberPostGatewayTimeout) IsCode(code int) bool { + return code == 504 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber post gateway timeout response +func (o *PcloudPvminstancesVirtualserialnumberPostGatewayTimeout) Code() int { + return 504 +} + +func (o *PcloudPvminstancesVirtualserialnumberPostGatewayTimeout) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPostGatewayTimeout %s", 504, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPostGatewayTimeout) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPostGatewayTimeout %s", 504, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPostGatewayTimeout) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberPostGatewayTimeout) 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/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_put_parameters.go b/power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_put_parameters.go new file mode 100644 index 00000000..f5efc13d --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_put_parameters.go @@ -0,0 +1,197 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_virtual_serial_number + +// 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" +) + +// NewPcloudPvminstancesVirtualserialnumberPutParams creates a new PcloudPvminstancesVirtualserialnumberPutParams 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 NewPcloudPvminstancesVirtualserialnumberPutParams() *PcloudPvminstancesVirtualserialnumberPutParams { + return &PcloudPvminstancesVirtualserialnumberPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesVirtualserialnumberPutParamsWithTimeout creates a new PcloudPvminstancesVirtualserialnumberPutParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesVirtualserialnumberPutParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesVirtualserialnumberPutParams { + return &PcloudPvminstancesVirtualserialnumberPutParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesVirtualserialnumberPutParamsWithContext creates a new PcloudPvminstancesVirtualserialnumberPutParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesVirtualserialnumberPutParamsWithContext(ctx context.Context) *PcloudPvminstancesVirtualserialnumberPutParams { + return &PcloudPvminstancesVirtualserialnumberPutParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesVirtualserialnumberPutParamsWithHTTPClient creates a new PcloudPvminstancesVirtualserialnumberPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesVirtualserialnumberPutParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesVirtualserialnumberPutParams { + return &PcloudPvminstancesVirtualserialnumberPutParams{ + HTTPClient: client, + } +} + +/* +PcloudPvminstancesVirtualserialnumberPutParams contains all the parameters to send to the API endpoint + + for the pcloud pvminstances virtualserialnumber put operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesVirtualserialnumberPutParams struct { + + /* Body. + + Parameters to update a Virtual Serial Number description + */ + Body *models.UpdateServerVirtualSerialNumber + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances virtualserialnumber put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVirtualserialnumberPutParams) WithDefaults() *PcloudPvminstancesVirtualserialnumberPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances virtualserialnumber put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVirtualserialnumberPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances virtualserialnumber put params +func (o *PcloudPvminstancesVirtualserialnumberPutParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesVirtualserialnumberPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances virtualserialnumber put params +func (o *PcloudPvminstancesVirtualserialnumberPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances virtualserialnumber put params +func (o *PcloudPvminstancesVirtualserialnumberPutParams) WithContext(ctx context.Context) *PcloudPvminstancesVirtualserialnumberPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances virtualserialnumber put params +func (o *PcloudPvminstancesVirtualserialnumberPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances virtualserialnumber put params +func (o *PcloudPvminstancesVirtualserialnumberPutParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesVirtualserialnumberPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances virtualserialnumber put params +func (o *PcloudPvminstancesVirtualserialnumberPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud pvminstances virtualserialnumber put params +func (o *PcloudPvminstancesVirtualserialnumberPutParams) WithBody(body *models.UpdateServerVirtualSerialNumber) *PcloudPvminstancesVirtualserialnumberPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud pvminstances virtualserialnumber put params +func (o *PcloudPvminstancesVirtualserialnumberPutParams) SetBody(body *models.UpdateServerVirtualSerialNumber) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances virtualserialnumber put params +func (o *PcloudPvminstancesVirtualserialnumberPutParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesVirtualserialnumberPutParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances virtualserialnumber put params +func (o *PcloudPvminstancesVirtualserialnumberPutParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances virtualserialnumber put params +func (o *PcloudPvminstancesVirtualserialnumberPutParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesVirtualserialnumberPutParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances virtualserialnumber put params +func (o *PcloudPvminstancesVirtualserialnumberPutParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesVirtualserialnumberPutParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_put_responses.go b/power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_put_responses.go new file mode 100644 index 00000000..669d081d --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_put_responses.go @@ -0,0 +1,562 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_virtual_serial_number + +// 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" +) + +// PcloudPvminstancesVirtualserialnumberPutReader is a Reader for the PcloudPvminstancesVirtualserialnumberPut structure. +type PcloudPvminstancesVirtualserialnumberPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesVirtualserialnumberPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPvminstancesVirtualserialnumberPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesVirtualserialnumberPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesVirtualserialnumberPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudPvminstancesVirtualserialnumberPutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudPvminstancesVirtualserialnumberPutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudPvminstancesVirtualserialnumberPutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesVirtualserialnumberPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number] pcloud.pvminstances.virtualserialnumber.put", response, response.Code()) + } +} + +// NewPcloudPvminstancesVirtualserialnumberPutOK creates a PcloudPvminstancesVirtualserialnumberPutOK with default headers values +func NewPcloudPvminstancesVirtualserialnumberPutOK() *PcloudPvminstancesVirtualserialnumberPutOK { + return &PcloudPvminstancesVirtualserialnumberPutOK{} +} + +/* +PcloudPvminstancesVirtualserialnumberPutOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPvminstancesVirtualserialnumberPutOK struct { + Payload *models.VirtualSerialNumber +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber put o k response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber put o k response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber put o k response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber put o k response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutOK) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber put o k response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberPutOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber put o k response +func (o *PcloudPvminstancesVirtualserialnumberPutOK) Code() int { + return 200 +} + +func (o *PcloudPvminstancesVirtualserialnumberPutOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPutOK %s", 200, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPutOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPutOK %s", 200, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPutOK) GetPayload() *models.VirtualSerialNumber { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.VirtualSerialNumber) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPvminstancesVirtualserialnumberPutBadRequest creates a PcloudPvminstancesVirtualserialnumberPutBadRequest with default headers values +func NewPcloudPvminstancesVirtualserialnumberPutBadRequest() *PcloudPvminstancesVirtualserialnumberPutBadRequest { + return &PcloudPvminstancesVirtualserialnumberPutBadRequest{} +} + +/* +PcloudPvminstancesVirtualserialnumberPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesVirtualserialnumberPutBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber put bad request response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber put bad request response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber put bad request response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber put bad request response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber put bad request response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberPutBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber put bad request response +func (o *PcloudPvminstancesVirtualserialnumberPutBadRequest) Code() int { + return 400 +} + +func (o *PcloudPvminstancesVirtualserialnumberPutBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPutBadRequest %s", 400, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPutBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPutBadRequest %s", 400, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberPutBadRequest) 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 +} + +// NewPcloudPvminstancesVirtualserialnumberPutUnauthorized creates a PcloudPvminstancesVirtualserialnumberPutUnauthorized with default headers values +func NewPcloudPvminstancesVirtualserialnumberPutUnauthorized() *PcloudPvminstancesVirtualserialnumberPutUnauthorized { + return &PcloudPvminstancesVirtualserialnumberPutUnauthorized{} +} + +/* +PcloudPvminstancesVirtualserialnumberPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesVirtualserialnumberPutUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber put unauthorized response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber put unauthorized response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber put unauthorized response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber put unauthorized response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber put unauthorized response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberPutUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber put unauthorized response +func (o *PcloudPvminstancesVirtualserialnumberPutUnauthorized) Code() int { + return 401 +} + +func (o *PcloudPvminstancesVirtualserialnumberPutUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPutUnauthorized %s", 401, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPutUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPutUnauthorized %s", 401, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberPutUnauthorized) 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 +} + +// NewPcloudPvminstancesVirtualserialnumberPutForbidden creates a PcloudPvminstancesVirtualserialnumberPutForbidden with default headers values +func NewPcloudPvminstancesVirtualserialnumberPutForbidden() *PcloudPvminstancesVirtualserialnumberPutForbidden { + return &PcloudPvminstancesVirtualserialnumberPutForbidden{} +} + +/* +PcloudPvminstancesVirtualserialnumberPutForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudPvminstancesVirtualserialnumberPutForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber put forbidden response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber put forbidden response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber put forbidden response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber put forbidden response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber put forbidden response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberPutForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber put forbidden response +func (o *PcloudPvminstancesVirtualserialnumberPutForbidden) Code() int { + return 403 +} + +func (o *PcloudPvminstancesVirtualserialnumberPutForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPutForbidden %s", 403, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPutForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPutForbidden %s", 403, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPutForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberPutForbidden) 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 +} + +// NewPcloudPvminstancesVirtualserialnumberPutNotFound creates a PcloudPvminstancesVirtualserialnumberPutNotFound with default headers values +func NewPcloudPvminstancesVirtualserialnumberPutNotFound() *PcloudPvminstancesVirtualserialnumberPutNotFound { + return &PcloudPvminstancesVirtualserialnumberPutNotFound{} +} + +/* +PcloudPvminstancesVirtualserialnumberPutNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPvminstancesVirtualserialnumberPutNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber put not found response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber put not found response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber put not found response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber put not found response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber put not found response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberPutNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber put not found response +func (o *PcloudPvminstancesVirtualserialnumberPutNotFound) Code() int { + return 404 +} + +func (o *PcloudPvminstancesVirtualserialnumberPutNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPutNotFound %s", 404, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPutNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPutNotFound %s", 404, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPutNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberPutNotFound) 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 +} + +// NewPcloudPvminstancesVirtualserialnumberPutUnprocessableEntity creates a PcloudPvminstancesVirtualserialnumberPutUnprocessableEntity with default headers values +func NewPcloudPvminstancesVirtualserialnumberPutUnprocessableEntity() *PcloudPvminstancesVirtualserialnumberPutUnprocessableEntity { + return &PcloudPvminstancesVirtualserialnumberPutUnprocessableEntity{} +} + +/* +PcloudPvminstancesVirtualserialnumberPutUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudPvminstancesVirtualserialnumberPutUnprocessableEntity struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber put unprocessable entity response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber put unprocessable entity response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber put unprocessable entity response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber put unprocessable entity response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber put unprocessable entity response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberPutUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber put unprocessable entity response +func (o *PcloudPvminstancesVirtualserialnumberPutUnprocessableEntity) Code() int { + return 422 +} + +func (o *PcloudPvminstancesVirtualserialnumberPutUnprocessableEntity) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPutUnprocessableEntity %s", 422, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPutUnprocessableEntity) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPutUnprocessableEntity %s", 422, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberPutUnprocessableEntity) 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 +} + +// NewPcloudPvminstancesVirtualserialnumberPutInternalServerError creates a PcloudPvminstancesVirtualserialnumberPutInternalServerError with default headers values +func NewPcloudPvminstancesVirtualserialnumberPutInternalServerError() *PcloudPvminstancesVirtualserialnumberPutInternalServerError { + return &PcloudPvminstancesVirtualserialnumberPutInternalServerError{} +} + +/* +PcloudPvminstancesVirtualserialnumberPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesVirtualserialnumberPutInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber put internal server error response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber put internal server error response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber put internal server error response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber put internal server error response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberPutInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber put internal server error response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberPutInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber put internal server error response +func (o *PcloudPvminstancesVirtualserialnumberPutInternalServerError) Code() int { + return 500 +} + +func (o *PcloudPvminstancesVirtualserialnumberPutInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPutInternalServerError %s", 500, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPutInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/virtual-serial-number][%d] pcloudPvminstancesVirtualserialnumberPutInternalServerError %s", 500, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberPutInternalServerError) 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/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_delete_parameters.go b/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_delete_parameters.go new file mode 100644 index 00000000..ae2e40f9 --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_virtual_serial_number + +// 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" +) + +// NewPcloudVirtualserialnumberDeleteParams creates a new PcloudVirtualserialnumberDeleteParams 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 NewPcloudVirtualserialnumberDeleteParams() *PcloudVirtualserialnumberDeleteParams { + return &PcloudVirtualserialnumberDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudVirtualserialnumberDeleteParamsWithTimeout creates a new PcloudVirtualserialnumberDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudVirtualserialnumberDeleteParamsWithTimeout(timeout time.Duration) *PcloudVirtualserialnumberDeleteParams { + return &PcloudVirtualserialnumberDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudVirtualserialnumberDeleteParamsWithContext creates a new PcloudVirtualserialnumberDeleteParams object +// with the ability to set a context for a request. +func NewPcloudVirtualserialnumberDeleteParamsWithContext(ctx context.Context) *PcloudVirtualserialnumberDeleteParams { + return &PcloudVirtualserialnumberDeleteParams{ + Context: ctx, + } +} + +// NewPcloudVirtualserialnumberDeleteParamsWithHTTPClient creates a new PcloudVirtualserialnumberDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudVirtualserialnumberDeleteParamsWithHTTPClient(client *http.Client) *PcloudVirtualserialnumberDeleteParams { + return &PcloudVirtualserialnumberDeleteParams{ + HTTPClient: client, + } +} + +/* +PcloudVirtualserialnumberDeleteParams contains all the parameters to send to the API endpoint + + for the pcloud virtualserialnumber delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudVirtualserialnumberDeleteParams struct { + + /* VirtualSerialNumber. + + Virtual Serial Number + */ + VirtualSerialNumber string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud virtualserialnumber delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVirtualserialnumberDeleteParams) WithDefaults() *PcloudVirtualserialnumberDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud virtualserialnumber delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVirtualserialnumberDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud virtualserialnumber delete params +func (o *PcloudVirtualserialnumberDeleteParams) WithTimeout(timeout time.Duration) *PcloudVirtualserialnumberDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud virtualserialnumber delete params +func (o *PcloudVirtualserialnumberDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud virtualserialnumber delete params +func (o *PcloudVirtualserialnumberDeleteParams) WithContext(ctx context.Context) *PcloudVirtualserialnumberDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud virtualserialnumber delete params +func (o *PcloudVirtualserialnumberDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud virtualserialnumber delete params +func (o *PcloudVirtualserialnumberDeleteParams) WithHTTPClient(client *http.Client) *PcloudVirtualserialnumberDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud virtualserialnumber delete params +func (o *PcloudVirtualserialnumberDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithVirtualSerialNumber adds the virtualSerialNumber to the pcloud virtualserialnumber delete params +func (o *PcloudVirtualserialnumberDeleteParams) WithVirtualSerialNumber(virtualSerialNumber string) *PcloudVirtualserialnumberDeleteParams { + o.SetVirtualSerialNumber(virtualSerialNumber) + return o +} + +// SetVirtualSerialNumber adds the virtualSerialNumber to the pcloud virtualserialnumber delete params +func (o *PcloudVirtualserialnumberDeleteParams) SetVirtualSerialNumber(virtualSerialNumber string) { + o.VirtualSerialNumber = virtualSerialNumber +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudVirtualserialnumberDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param virtual_serial_number + if err := r.SetPathParam("virtual_serial_number", o.VirtualSerialNumber); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_delete_responses.go b/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_delete_responses.go new file mode 100644 index 00000000..c067ad87 --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_delete_responses.go @@ -0,0 +1,560 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_virtual_serial_number + +// 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" +) + +// PcloudVirtualserialnumberDeleteReader is a Reader for the PcloudVirtualserialnumberDelete structure. +type PcloudVirtualserialnumberDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudVirtualserialnumberDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudVirtualserialnumberDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudVirtualserialnumberDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudVirtualserialnumberDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudVirtualserialnumberDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudVirtualserialnumberDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 410: + result := NewPcloudVirtualserialnumberDeleteGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudVirtualserialnumberDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /v1/virtual-serial-number/{virtual_serial_number}] pcloud.virtualserialnumber.delete", response, response.Code()) + } +} + +// NewPcloudVirtualserialnumberDeleteOK creates a PcloudVirtualserialnumberDeleteOK with default headers values +func NewPcloudVirtualserialnumberDeleteOK() *PcloudVirtualserialnumberDeleteOK { + return &PcloudVirtualserialnumberDeleteOK{} +} + +/* +PcloudVirtualserialnumberDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudVirtualserialnumberDeleteOK struct { + Payload models.Object +} + +// IsSuccess returns true when this pcloud virtualserialnumber delete o k response has a 2xx status code +func (o *PcloudVirtualserialnumberDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this pcloud virtualserialnumber delete o k response has a 3xx status code +func (o *PcloudVirtualserialnumberDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber delete o k response has a 4xx status code +func (o *PcloudVirtualserialnumberDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud virtualserialnumber delete o k response has a 5xx status code +func (o *PcloudVirtualserialnumberDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber delete o k response a status code equal to that given +func (o *PcloudVirtualserialnumberDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the pcloud virtualserialnumber delete o k response +func (o *PcloudVirtualserialnumberDeleteOK) Code() int { + return 200 +} + +func (o *PcloudVirtualserialnumberDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberDeleteOK %s", 200, payload) +} + +func (o *PcloudVirtualserialnumberDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberDeleteOK %s", 200, payload) +} + +func (o *PcloudVirtualserialnumberDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudVirtualserialnumberDeleteOK) 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 +} + +// NewPcloudVirtualserialnumberDeleteBadRequest creates a PcloudVirtualserialnumberDeleteBadRequest with default headers values +func NewPcloudVirtualserialnumberDeleteBadRequest() *PcloudVirtualserialnumberDeleteBadRequest { + return &PcloudVirtualserialnumberDeleteBadRequest{} +} + +/* +PcloudVirtualserialnumberDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudVirtualserialnumberDeleteBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber delete bad request response has a 2xx status code +func (o *PcloudVirtualserialnumberDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber delete bad request response has a 3xx status code +func (o *PcloudVirtualserialnumberDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber delete bad request response has a 4xx status code +func (o *PcloudVirtualserialnumberDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud virtualserialnumber delete bad request response has a 5xx status code +func (o *PcloudVirtualserialnumberDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber delete bad request response a status code equal to that given +func (o *PcloudVirtualserialnumberDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the pcloud virtualserialnumber delete bad request response +func (o *PcloudVirtualserialnumberDeleteBadRequest) Code() int { + return 400 +} + +func (o *PcloudVirtualserialnumberDeleteBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberDeleteBadRequest %s", 400, payload) +} + +func (o *PcloudVirtualserialnumberDeleteBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberDeleteBadRequest %s", 400, payload) +} + +func (o *PcloudVirtualserialnumberDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberDeleteBadRequest) 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 +} + +// NewPcloudVirtualserialnumberDeleteUnauthorized creates a PcloudVirtualserialnumberDeleteUnauthorized with default headers values +func NewPcloudVirtualserialnumberDeleteUnauthorized() *PcloudVirtualserialnumberDeleteUnauthorized { + return &PcloudVirtualserialnumberDeleteUnauthorized{} +} + +/* +PcloudVirtualserialnumberDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudVirtualserialnumberDeleteUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber delete unauthorized response has a 2xx status code +func (o *PcloudVirtualserialnumberDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber delete unauthorized response has a 3xx status code +func (o *PcloudVirtualserialnumberDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber delete unauthorized response has a 4xx status code +func (o *PcloudVirtualserialnumberDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud virtualserialnumber delete unauthorized response has a 5xx status code +func (o *PcloudVirtualserialnumberDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber delete unauthorized response a status code equal to that given +func (o *PcloudVirtualserialnumberDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the pcloud virtualserialnumber delete unauthorized response +func (o *PcloudVirtualserialnumberDeleteUnauthorized) Code() int { + return 401 +} + +func (o *PcloudVirtualserialnumberDeleteUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberDeleteUnauthorized %s", 401, payload) +} + +func (o *PcloudVirtualserialnumberDeleteUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberDeleteUnauthorized %s", 401, payload) +} + +func (o *PcloudVirtualserialnumberDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberDeleteUnauthorized) 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 +} + +// NewPcloudVirtualserialnumberDeleteForbidden creates a PcloudVirtualserialnumberDeleteForbidden with default headers values +func NewPcloudVirtualserialnumberDeleteForbidden() *PcloudVirtualserialnumberDeleteForbidden { + return &PcloudVirtualserialnumberDeleteForbidden{} +} + +/* +PcloudVirtualserialnumberDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudVirtualserialnumberDeleteForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber delete forbidden response has a 2xx status code +func (o *PcloudVirtualserialnumberDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber delete forbidden response has a 3xx status code +func (o *PcloudVirtualserialnumberDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber delete forbidden response has a 4xx status code +func (o *PcloudVirtualserialnumberDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud virtualserialnumber delete forbidden response has a 5xx status code +func (o *PcloudVirtualserialnumberDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber delete forbidden response a status code equal to that given +func (o *PcloudVirtualserialnumberDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the pcloud virtualserialnumber delete forbidden response +func (o *PcloudVirtualserialnumberDeleteForbidden) Code() int { + return 403 +} + +func (o *PcloudVirtualserialnumberDeleteForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberDeleteForbidden %s", 403, payload) +} + +func (o *PcloudVirtualserialnumberDeleteForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberDeleteForbidden %s", 403, payload) +} + +func (o *PcloudVirtualserialnumberDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberDeleteForbidden) 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 +} + +// NewPcloudVirtualserialnumberDeleteNotFound creates a PcloudVirtualserialnumberDeleteNotFound with default headers values +func NewPcloudVirtualserialnumberDeleteNotFound() *PcloudVirtualserialnumberDeleteNotFound { + return &PcloudVirtualserialnumberDeleteNotFound{} +} + +/* +PcloudVirtualserialnumberDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudVirtualserialnumberDeleteNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber delete not found response has a 2xx status code +func (o *PcloudVirtualserialnumberDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber delete not found response has a 3xx status code +func (o *PcloudVirtualserialnumberDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber delete not found response has a 4xx status code +func (o *PcloudVirtualserialnumberDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud virtualserialnumber delete not found response has a 5xx status code +func (o *PcloudVirtualserialnumberDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber delete not found response a status code equal to that given +func (o *PcloudVirtualserialnumberDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the pcloud virtualserialnumber delete not found response +func (o *PcloudVirtualserialnumberDeleteNotFound) Code() int { + return 404 +} + +func (o *PcloudVirtualserialnumberDeleteNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberDeleteNotFound %s", 404, payload) +} + +func (o *PcloudVirtualserialnumberDeleteNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberDeleteNotFound %s", 404, payload) +} + +func (o *PcloudVirtualserialnumberDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberDeleteNotFound) 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 +} + +// NewPcloudVirtualserialnumberDeleteGone creates a PcloudVirtualserialnumberDeleteGone with default headers values +func NewPcloudVirtualserialnumberDeleteGone() *PcloudVirtualserialnumberDeleteGone { + return &PcloudVirtualserialnumberDeleteGone{} +} + +/* +PcloudVirtualserialnumberDeleteGone describes a response with status code 410, with default header values. + +Gone +*/ +type PcloudVirtualserialnumberDeleteGone struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber delete gone response has a 2xx status code +func (o *PcloudVirtualserialnumberDeleteGone) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber delete gone response has a 3xx status code +func (o *PcloudVirtualserialnumberDeleteGone) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber delete gone response has a 4xx status code +func (o *PcloudVirtualserialnumberDeleteGone) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud virtualserialnumber delete gone response has a 5xx status code +func (o *PcloudVirtualserialnumberDeleteGone) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber delete gone response a status code equal to that given +func (o *PcloudVirtualserialnumberDeleteGone) IsCode(code int) bool { + return code == 410 +} + +// Code gets the status code for the pcloud virtualserialnumber delete gone response +func (o *PcloudVirtualserialnumberDeleteGone) Code() int { + return 410 +} + +func (o *PcloudVirtualserialnumberDeleteGone) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberDeleteGone %s", 410, payload) +} + +func (o *PcloudVirtualserialnumberDeleteGone) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberDeleteGone %s", 410, payload) +} + +func (o *PcloudVirtualserialnumberDeleteGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberDeleteGone) 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 +} + +// NewPcloudVirtualserialnumberDeleteInternalServerError creates a PcloudVirtualserialnumberDeleteInternalServerError with default headers values +func NewPcloudVirtualserialnumberDeleteInternalServerError() *PcloudVirtualserialnumberDeleteInternalServerError { + return &PcloudVirtualserialnumberDeleteInternalServerError{} +} + +/* +PcloudVirtualserialnumberDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudVirtualserialnumberDeleteInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber delete internal server error response has a 2xx status code +func (o *PcloudVirtualserialnumberDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber delete internal server error response has a 3xx status code +func (o *PcloudVirtualserialnumberDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber delete internal server error response has a 4xx status code +func (o *PcloudVirtualserialnumberDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud virtualserialnumber delete internal server error response has a 5xx status code +func (o *PcloudVirtualserialnumberDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this pcloud virtualserialnumber delete internal server error response a status code equal to that given +func (o *PcloudVirtualserialnumberDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the pcloud virtualserialnumber delete internal server error response +func (o *PcloudVirtualserialnumberDeleteInternalServerError) Code() int { + return 500 +} + +func (o *PcloudVirtualserialnumberDeleteInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberDeleteInternalServerError %s", 500, payload) +} + +func (o *PcloudVirtualserialnumberDeleteInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberDeleteInternalServerError %s", 500, payload) +} + +func (o *PcloudVirtualserialnumberDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberDeleteInternalServerError) 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/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_get_parameters.go b/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_get_parameters.go new file mode 100644 index 00000000..61743a76 --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_virtual_serial_number + +// 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" +) + +// NewPcloudVirtualserialnumberGetParams creates a new PcloudVirtualserialnumberGetParams 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 NewPcloudVirtualserialnumberGetParams() *PcloudVirtualserialnumberGetParams { + return &PcloudVirtualserialnumberGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudVirtualserialnumberGetParamsWithTimeout creates a new PcloudVirtualserialnumberGetParams object +// with the ability to set a timeout on a request. +func NewPcloudVirtualserialnumberGetParamsWithTimeout(timeout time.Duration) *PcloudVirtualserialnumberGetParams { + return &PcloudVirtualserialnumberGetParams{ + timeout: timeout, + } +} + +// NewPcloudVirtualserialnumberGetParamsWithContext creates a new PcloudVirtualserialnumberGetParams object +// with the ability to set a context for a request. +func NewPcloudVirtualserialnumberGetParamsWithContext(ctx context.Context) *PcloudVirtualserialnumberGetParams { + return &PcloudVirtualserialnumberGetParams{ + Context: ctx, + } +} + +// NewPcloudVirtualserialnumberGetParamsWithHTTPClient creates a new PcloudVirtualserialnumberGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudVirtualserialnumberGetParamsWithHTTPClient(client *http.Client) *PcloudVirtualserialnumberGetParams { + return &PcloudVirtualserialnumberGetParams{ + HTTPClient: client, + } +} + +/* +PcloudVirtualserialnumberGetParams contains all the parameters to send to the API endpoint + + for the pcloud virtualserialnumber get operation. + + Typically these are written to a http.Request. +*/ +type PcloudVirtualserialnumberGetParams struct { + + /* VirtualSerialNumber. + + Virtual Serial Number + */ + VirtualSerialNumber string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud virtualserialnumber get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVirtualserialnumberGetParams) WithDefaults() *PcloudVirtualserialnumberGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud virtualserialnumber get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVirtualserialnumberGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud virtualserialnumber get params +func (o *PcloudVirtualserialnumberGetParams) WithTimeout(timeout time.Duration) *PcloudVirtualserialnumberGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud virtualserialnumber get params +func (o *PcloudVirtualserialnumberGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud virtualserialnumber get params +func (o *PcloudVirtualserialnumberGetParams) WithContext(ctx context.Context) *PcloudVirtualserialnumberGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud virtualserialnumber get params +func (o *PcloudVirtualserialnumberGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud virtualserialnumber get params +func (o *PcloudVirtualserialnumberGetParams) WithHTTPClient(client *http.Client) *PcloudVirtualserialnumberGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud virtualserialnumber get params +func (o *PcloudVirtualserialnumberGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithVirtualSerialNumber adds the virtualSerialNumber to the pcloud virtualserialnumber get params +func (o *PcloudVirtualserialnumberGetParams) WithVirtualSerialNumber(virtualSerialNumber string) *PcloudVirtualserialnumberGetParams { + o.SetVirtualSerialNumber(virtualSerialNumber) + return o +} + +// SetVirtualSerialNumber adds the virtualSerialNumber to the pcloud virtualserialnumber get params +func (o *PcloudVirtualserialnumberGetParams) SetVirtualSerialNumber(virtualSerialNumber string) { + o.VirtualSerialNumber = virtualSerialNumber +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudVirtualserialnumberGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param virtual_serial_number + if err := r.SetPathParam("virtual_serial_number", o.VirtualSerialNumber); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_get_responses.go b/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_get_responses.go new file mode 100644 index 00000000..720b911b --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_get_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_virtual_serial_number + +// 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" +) + +// PcloudVirtualserialnumberGetReader is a Reader for the PcloudVirtualserialnumberGet structure. +type PcloudVirtualserialnumberGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudVirtualserialnumberGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudVirtualserialnumberGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudVirtualserialnumberGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudVirtualserialnumberGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudVirtualserialnumberGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudVirtualserialnumberGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudVirtualserialnumberGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/virtual-serial-number/{virtual_serial_number}] pcloud.virtualserialnumber.get", response, response.Code()) + } +} + +// NewPcloudVirtualserialnumberGetOK creates a PcloudVirtualserialnumberGetOK with default headers values +func NewPcloudVirtualserialnumberGetOK() *PcloudVirtualserialnumberGetOK { + return &PcloudVirtualserialnumberGetOK{} +} + +/* +PcloudVirtualserialnumberGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudVirtualserialnumberGetOK struct { + Payload *models.VirtualSerialNumber +} + +// IsSuccess returns true when this pcloud virtualserialnumber get o k response has a 2xx status code +func (o *PcloudVirtualserialnumberGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this pcloud virtualserialnumber get o k response has a 3xx status code +func (o *PcloudVirtualserialnumberGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber get o k response has a 4xx status code +func (o *PcloudVirtualserialnumberGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud virtualserialnumber get o k response has a 5xx status code +func (o *PcloudVirtualserialnumberGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber get o k response a status code equal to that given +func (o *PcloudVirtualserialnumberGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the pcloud virtualserialnumber get o k response +func (o *PcloudVirtualserialnumberGetOK) Code() int { + return 200 +} + +func (o *PcloudVirtualserialnumberGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberGetOK %s", 200, payload) +} + +func (o *PcloudVirtualserialnumberGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberGetOK %s", 200, payload) +} + +func (o *PcloudVirtualserialnumberGetOK) GetPayload() *models.VirtualSerialNumber { + return o.Payload +} + +func (o *PcloudVirtualserialnumberGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.VirtualSerialNumber) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudVirtualserialnumberGetBadRequest creates a PcloudVirtualserialnumberGetBadRequest with default headers values +func NewPcloudVirtualserialnumberGetBadRequest() *PcloudVirtualserialnumberGetBadRequest { + return &PcloudVirtualserialnumberGetBadRequest{} +} + +/* +PcloudVirtualserialnumberGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudVirtualserialnumberGetBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber get bad request response has a 2xx status code +func (o *PcloudVirtualserialnumberGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber get bad request response has a 3xx status code +func (o *PcloudVirtualserialnumberGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber get bad request response has a 4xx status code +func (o *PcloudVirtualserialnumberGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud virtualserialnumber get bad request response has a 5xx status code +func (o *PcloudVirtualserialnumberGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber get bad request response a status code equal to that given +func (o *PcloudVirtualserialnumberGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the pcloud virtualserialnumber get bad request response +func (o *PcloudVirtualserialnumberGetBadRequest) Code() int { + return 400 +} + +func (o *PcloudVirtualserialnumberGetBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberGetBadRequest %s", 400, payload) +} + +func (o *PcloudVirtualserialnumberGetBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberGetBadRequest %s", 400, payload) +} + +func (o *PcloudVirtualserialnumberGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberGetBadRequest) 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 +} + +// NewPcloudVirtualserialnumberGetUnauthorized creates a PcloudVirtualserialnumberGetUnauthorized with default headers values +func NewPcloudVirtualserialnumberGetUnauthorized() *PcloudVirtualserialnumberGetUnauthorized { + return &PcloudVirtualserialnumberGetUnauthorized{} +} + +/* +PcloudVirtualserialnumberGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudVirtualserialnumberGetUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber get unauthorized response has a 2xx status code +func (o *PcloudVirtualserialnumberGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber get unauthorized response has a 3xx status code +func (o *PcloudVirtualserialnumberGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber get unauthorized response has a 4xx status code +func (o *PcloudVirtualserialnumberGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud virtualserialnumber get unauthorized response has a 5xx status code +func (o *PcloudVirtualserialnumberGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber get unauthorized response a status code equal to that given +func (o *PcloudVirtualserialnumberGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the pcloud virtualserialnumber get unauthorized response +func (o *PcloudVirtualserialnumberGetUnauthorized) Code() int { + return 401 +} + +func (o *PcloudVirtualserialnumberGetUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberGetUnauthorized %s", 401, payload) +} + +func (o *PcloudVirtualserialnumberGetUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberGetUnauthorized %s", 401, payload) +} + +func (o *PcloudVirtualserialnumberGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberGetUnauthorized) 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 +} + +// NewPcloudVirtualserialnumberGetForbidden creates a PcloudVirtualserialnumberGetForbidden with default headers values +func NewPcloudVirtualserialnumberGetForbidden() *PcloudVirtualserialnumberGetForbidden { + return &PcloudVirtualserialnumberGetForbidden{} +} + +/* +PcloudVirtualserialnumberGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudVirtualserialnumberGetForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber get forbidden response has a 2xx status code +func (o *PcloudVirtualserialnumberGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber get forbidden response has a 3xx status code +func (o *PcloudVirtualserialnumberGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber get forbidden response has a 4xx status code +func (o *PcloudVirtualserialnumberGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud virtualserialnumber get forbidden response has a 5xx status code +func (o *PcloudVirtualserialnumberGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber get forbidden response a status code equal to that given +func (o *PcloudVirtualserialnumberGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the pcloud virtualserialnumber get forbidden response +func (o *PcloudVirtualserialnumberGetForbidden) Code() int { + return 403 +} + +func (o *PcloudVirtualserialnumberGetForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberGetForbidden %s", 403, payload) +} + +func (o *PcloudVirtualserialnumberGetForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberGetForbidden %s", 403, payload) +} + +func (o *PcloudVirtualserialnumberGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberGetForbidden) 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 +} + +// NewPcloudVirtualserialnumberGetNotFound creates a PcloudVirtualserialnumberGetNotFound with default headers values +func NewPcloudVirtualserialnumberGetNotFound() *PcloudVirtualserialnumberGetNotFound { + return &PcloudVirtualserialnumberGetNotFound{} +} + +/* +PcloudVirtualserialnumberGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudVirtualserialnumberGetNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber get not found response has a 2xx status code +func (o *PcloudVirtualserialnumberGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber get not found response has a 3xx status code +func (o *PcloudVirtualserialnumberGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber get not found response has a 4xx status code +func (o *PcloudVirtualserialnumberGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud virtualserialnumber get not found response has a 5xx status code +func (o *PcloudVirtualserialnumberGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber get not found response a status code equal to that given +func (o *PcloudVirtualserialnumberGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the pcloud virtualserialnumber get not found response +func (o *PcloudVirtualserialnumberGetNotFound) Code() int { + return 404 +} + +func (o *PcloudVirtualserialnumberGetNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberGetNotFound %s", 404, payload) +} + +func (o *PcloudVirtualserialnumberGetNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberGetNotFound %s", 404, payload) +} + +func (o *PcloudVirtualserialnumberGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberGetNotFound) 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 +} + +// NewPcloudVirtualserialnumberGetInternalServerError creates a PcloudVirtualserialnumberGetInternalServerError with default headers values +func NewPcloudVirtualserialnumberGetInternalServerError() *PcloudVirtualserialnumberGetInternalServerError { + return &PcloudVirtualserialnumberGetInternalServerError{} +} + +/* +PcloudVirtualserialnumberGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudVirtualserialnumberGetInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber get internal server error response has a 2xx status code +func (o *PcloudVirtualserialnumberGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber get internal server error response has a 3xx status code +func (o *PcloudVirtualserialnumberGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber get internal server error response has a 4xx status code +func (o *PcloudVirtualserialnumberGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud virtualserialnumber get internal server error response has a 5xx status code +func (o *PcloudVirtualserialnumberGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this pcloud virtualserialnumber get internal server error response a status code equal to that given +func (o *PcloudVirtualserialnumberGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the pcloud virtualserialnumber get internal server error response +func (o *PcloudVirtualserialnumberGetInternalServerError) Code() int { + return 500 +} + +func (o *PcloudVirtualserialnumberGetInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberGetInternalServerError %s", 500, payload) +} + +func (o *PcloudVirtualserialnumberGetInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberGetInternalServerError %s", 500, payload) +} + +func (o *PcloudVirtualserialnumberGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberGetInternalServerError) 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/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_getall_parameters.go b/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_getall_parameters.go new file mode 100644 index 00000000..72e191ad --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_getall_parameters.go @@ -0,0 +1,163 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_virtual_serial_number + +// 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" +) + +// NewPcloudVirtualserialnumberGetallParams creates a new PcloudVirtualserialnumberGetallParams 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 NewPcloudVirtualserialnumberGetallParams() *PcloudVirtualserialnumberGetallParams { + return &PcloudVirtualserialnumberGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudVirtualserialnumberGetallParamsWithTimeout creates a new PcloudVirtualserialnumberGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudVirtualserialnumberGetallParamsWithTimeout(timeout time.Duration) *PcloudVirtualserialnumberGetallParams { + return &PcloudVirtualserialnumberGetallParams{ + timeout: timeout, + } +} + +// NewPcloudVirtualserialnumberGetallParamsWithContext creates a new PcloudVirtualserialnumberGetallParams object +// with the ability to set a context for a request. +func NewPcloudVirtualserialnumberGetallParamsWithContext(ctx context.Context) *PcloudVirtualserialnumberGetallParams { + return &PcloudVirtualserialnumberGetallParams{ + Context: ctx, + } +} + +// NewPcloudVirtualserialnumberGetallParamsWithHTTPClient creates a new PcloudVirtualserialnumberGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudVirtualserialnumberGetallParamsWithHTTPClient(client *http.Client) *PcloudVirtualserialnumberGetallParams { + return &PcloudVirtualserialnumberGetallParams{ + HTTPClient: client, + } +} + +/* +PcloudVirtualserialnumberGetallParams contains all the parameters to send to the API endpoint + + for the pcloud virtualserialnumber getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudVirtualserialnumberGetallParams struct { + + /* PvmInstanceID. + + PVM Instance ID + */ + PvmInstanceID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud virtualserialnumber getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVirtualserialnumberGetallParams) WithDefaults() *PcloudVirtualserialnumberGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud virtualserialnumber getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVirtualserialnumberGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud virtualserialnumber getall params +func (o *PcloudVirtualserialnumberGetallParams) WithTimeout(timeout time.Duration) *PcloudVirtualserialnumberGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud virtualserialnumber getall params +func (o *PcloudVirtualserialnumberGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud virtualserialnumber getall params +func (o *PcloudVirtualserialnumberGetallParams) WithContext(ctx context.Context) *PcloudVirtualserialnumberGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud virtualserialnumber getall params +func (o *PcloudVirtualserialnumberGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud virtualserialnumber getall params +func (o *PcloudVirtualserialnumberGetallParams) WithHTTPClient(client *http.Client) *PcloudVirtualserialnumberGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud virtualserialnumber getall params +func (o *PcloudVirtualserialnumberGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud virtualserialnumber getall params +func (o *PcloudVirtualserialnumberGetallParams) WithPvmInstanceID(pvmInstanceID *string) *PcloudVirtualserialnumberGetallParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud virtualserialnumber getall params +func (o *PcloudVirtualserialnumberGetallParams) SetPvmInstanceID(pvmInstanceID *string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudVirtualserialnumberGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.PvmInstanceID != nil { + + // query param pvmInstanceID + var qrPvmInstanceID string + + if o.PvmInstanceID != nil { + qrPvmInstanceID = *o.PvmInstanceID + } + qPvmInstanceID := qrPvmInstanceID + if qPvmInstanceID != "" { + + if err := r.SetQueryParam("pvmInstanceID", qPvmInstanceID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_getall_responses.go b/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_getall_responses.go new file mode 100644 index 00000000..9484d007 --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_getall_responses.go @@ -0,0 +1,484 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_virtual_serial_number + +// 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" +) + +// PcloudVirtualserialnumberGetallReader is a Reader for the PcloudVirtualserialnumberGetall structure. +type PcloudVirtualserialnumberGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudVirtualserialnumberGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudVirtualserialnumberGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudVirtualserialnumberGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudVirtualserialnumberGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudVirtualserialnumberGetallForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudVirtualserialnumberGetallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudVirtualserialnumberGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/virtual-serial-number] pcloud.virtualserialnumber.getall", response, response.Code()) + } +} + +// NewPcloudVirtualserialnumberGetallOK creates a PcloudVirtualserialnumberGetallOK with default headers values +func NewPcloudVirtualserialnumberGetallOK() *PcloudVirtualserialnumberGetallOK { + return &PcloudVirtualserialnumberGetallOK{} +} + +/* +PcloudVirtualserialnumberGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudVirtualserialnumberGetallOK struct { + Payload models.VirtualSerialNumberList +} + +// IsSuccess returns true when this pcloud virtualserialnumber getall o k response has a 2xx status code +func (o *PcloudVirtualserialnumberGetallOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this pcloud virtualserialnumber getall o k response has a 3xx status code +func (o *PcloudVirtualserialnumberGetallOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber getall o k response has a 4xx status code +func (o *PcloudVirtualserialnumberGetallOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud virtualserialnumber getall o k response has a 5xx status code +func (o *PcloudVirtualserialnumberGetallOK) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber getall o k response a status code equal to that given +func (o *PcloudVirtualserialnumberGetallOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the pcloud virtualserialnumber getall o k response +func (o *PcloudVirtualserialnumberGetallOK) Code() int { + return 200 +} + +func (o *PcloudVirtualserialnumberGetallOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number][%d] pcloudVirtualserialnumberGetallOK %s", 200, payload) +} + +func (o *PcloudVirtualserialnumberGetallOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number][%d] pcloudVirtualserialnumberGetallOK %s", 200, payload) +} + +func (o *PcloudVirtualserialnumberGetallOK) GetPayload() models.VirtualSerialNumberList { + return o.Payload +} + +func (o *PcloudVirtualserialnumberGetallOK) 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 +} + +// NewPcloudVirtualserialnumberGetallBadRequest creates a PcloudVirtualserialnumberGetallBadRequest with default headers values +func NewPcloudVirtualserialnumberGetallBadRequest() *PcloudVirtualserialnumberGetallBadRequest { + return &PcloudVirtualserialnumberGetallBadRequest{} +} + +/* +PcloudVirtualserialnumberGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudVirtualserialnumberGetallBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber getall bad request response has a 2xx status code +func (o *PcloudVirtualserialnumberGetallBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber getall bad request response has a 3xx status code +func (o *PcloudVirtualserialnumberGetallBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber getall bad request response has a 4xx status code +func (o *PcloudVirtualserialnumberGetallBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud virtualserialnumber getall bad request response has a 5xx status code +func (o *PcloudVirtualserialnumberGetallBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber getall bad request response a status code equal to that given +func (o *PcloudVirtualserialnumberGetallBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the pcloud virtualserialnumber getall bad request response +func (o *PcloudVirtualserialnumberGetallBadRequest) Code() int { + return 400 +} + +func (o *PcloudVirtualserialnumberGetallBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number][%d] pcloudVirtualserialnumberGetallBadRequest %s", 400, payload) +} + +func (o *PcloudVirtualserialnumberGetallBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number][%d] pcloudVirtualserialnumberGetallBadRequest %s", 400, payload) +} + +func (o *PcloudVirtualserialnumberGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberGetallBadRequest) 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 +} + +// NewPcloudVirtualserialnumberGetallUnauthorized creates a PcloudVirtualserialnumberGetallUnauthorized with default headers values +func NewPcloudVirtualserialnumberGetallUnauthorized() *PcloudVirtualserialnumberGetallUnauthorized { + return &PcloudVirtualserialnumberGetallUnauthorized{} +} + +/* +PcloudVirtualserialnumberGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudVirtualserialnumberGetallUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber getall unauthorized response has a 2xx status code +func (o *PcloudVirtualserialnumberGetallUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber getall unauthorized response has a 3xx status code +func (o *PcloudVirtualserialnumberGetallUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber getall unauthorized response has a 4xx status code +func (o *PcloudVirtualserialnumberGetallUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud virtualserialnumber getall unauthorized response has a 5xx status code +func (o *PcloudVirtualserialnumberGetallUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber getall unauthorized response a status code equal to that given +func (o *PcloudVirtualserialnumberGetallUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the pcloud virtualserialnumber getall unauthorized response +func (o *PcloudVirtualserialnumberGetallUnauthorized) Code() int { + return 401 +} + +func (o *PcloudVirtualserialnumberGetallUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number][%d] pcloudVirtualserialnumberGetallUnauthorized %s", 401, payload) +} + +func (o *PcloudVirtualserialnumberGetallUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number][%d] pcloudVirtualserialnumberGetallUnauthorized %s", 401, payload) +} + +func (o *PcloudVirtualserialnumberGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberGetallUnauthorized) 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 +} + +// NewPcloudVirtualserialnumberGetallForbidden creates a PcloudVirtualserialnumberGetallForbidden with default headers values +func NewPcloudVirtualserialnumberGetallForbidden() *PcloudVirtualserialnumberGetallForbidden { + return &PcloudVirtualserialnumberGetallForbidden{} +} + +/* +PcloudVirtualserialnumberGetallForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudVirtualserialnumberGetallForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber getall forbidden response has a 2xx status code +func (o *PcloudVirtualserialnumberGetallForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber getall forbidden response has a 3xx status code +func (o *PcloudVirtualserialnumberGetallForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber getall forbidden response has a 4xx status code +func (o *PcloudVirtualserialnumberGetallForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud virtualserialnumber getall forbidden response has a 5xx status code +func (o *PcloudVirtualserialnumberGetallForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber getall forbidden response a status code equal to that given +func (o *PcloudVirtualserialnumberGetallForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the pcloud virtualserialnumber getall forbidden response +func (o *PcloudVirtualserialnumberGetallForbidden) Code() int { + return 403 +} + +func (o *PcloudVirtualserialnumberGetallForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number][%d] pcloudVirtualserialnumberGetallForbidden %s", 403, payload) +} + +func (o *PcloudVirtualserialnumberGetallForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number][%d] pcloudVirtualserialnumberGetallForbidden %s", 403, payload) +} + +func (o *PcloudVirtualserialnumberGetallForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberGetallForbidden) 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 +} + +// NewPcloudVirtualserialnumberGetallNotFound creates a PcloudVirtualserialnumberGetallNotFound with default headers values +func NewPcloudVirtualserialnumberGetallNotFound() *PcloudVirtualserialnumberGetallNotFound { + return &PcloudVirtualserialnumberGetallNotFound{} +} + +/* +PcloudVirtualserialnumberGetallNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudVirtualserialnumberGetallNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber getall not found response has a 2xx status code +func (o *PcloudVirtualserialnumberGetallNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber getall not found response has a 3xx status code +func (o *PcloudVirtualserialnumberGetallNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber getall not found response has a 4xx status code +func (o *PcloudVirtualserialnumberGetallNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud virtualserialnumber getall not found response has a 5xx status code +func (o *PcloudVirtualserialnumberGetallNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber getall not found response a status code equal to that given +func (o *PcloudVirtualserialnumberGetallNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the pcloud virtualserialnumber getall not found response +func (o *PcloudVirtualserialnumberGetallNotFound) Code() int { + return 404 +} + +func (o *PcloudVirtualserialnumberGetallNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number][%d] pcloudVirtualserialnumberGetallNotFound %s", 404, payload) +} + +func (o *PcloudVirtualserialnumberGetallNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number][%d] pcloudVirtualserialnumberGetallNotFound %s", 404, payload) +} + +func (o *PcloudVirtualserialnumberGetallNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberGetallNotFound) 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 +} + +// NewPcloudVirtualserialnumberGetallInternalServerError creates a PcloudVirtualserialnumberGetallInternalServerError with default headers values +func NewPcloudVirtualserialnumberGetallInternalServerError() *PcloudVirtualserialnumberGetallInternalServerError { + return &PcloudVirtualserialnumberGetallInternalServerError{} +} + +/* +PcloudVirtualserialnumberGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudVirtualserialnumberGetallInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber getall internal server error response has a 2xx status code +func (o *PcloudVirtualserialnumberGetallInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber getall internal server error response has a 3xx status code +func (o *PcloudVirtualserialnumberGetallInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber getall internal server error response has a 4xx status code +func (o *PcloudVirtualserialnumberGetallInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud virtualserialnumber getall internal server error response has a 5xx status code +func (o *PcloudVirtualserialnumberGetallInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this pcloud virtualserialnumber getall internal server error response a status code equal to that given +func (o *PcloudVirtualserialnumberGetallInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the pcloud virtualserialnumber getall internal server error response +func (o *PcloudVirtualserialnumberGetallInternalServerError) Code() int { + return 500 +} + +func (o *PcloudVirtualserialnumberGetallInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number][%d] pcloudVirtualserialnumberGetallInternalServerError %s", 500, payload) +} + +func (o *PcloudVirtualserialnumberGetallInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/virtual-serial-number][%d] pcloudVirtualserialnumberGetallInternalServerError %s", 500, payload) +} + +func (o *PcloudVirtualserialnumberGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberGetallInternalServerError) 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/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_put_parameters.go b/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_put_parameters.go new file mode 100644 index 00000000..0597c0ba --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_put_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_virtual_serial_number + +// 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" +) + +// NewPcloudVirtualserialnumberPutParams creates a new PcloudVirtualserialnumberPutParams 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 NewPcloudVirtualserialnumberPutParams() *PcloudVirtualserialnumberPutParams { + return &PcloudVirtualserialnumberPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudVirtualserialnumberPutParamsWithTimeout creates a new PcloudVirtualserialnumberPutParams object +// with the ability to set a timeout on a request. +func NewPcloudVirtualserialnumberPutParamsWithTimeout(timeout time.Duration) *PcloudVirtualserialnumberPutParams { + return &PcloudVirtualserialnumberPutParams{ + timeout: timeout, + } +} + +// NewPcloudVirtualserialnumberPutParamsWithContext creates a new PcloudVirtualserialnumberPutParams object +// with the ability to set a context for a request. +func NewPcloudVirtualserialnumberPutParamsWithContext(ctx context.Context) *PcloudVirtualserialnumberPutParams { + return &PcloudVirtualserialnumberPutParams{ + Context: ctx, + } +} + +// NewPcloudVirtualserialnumberPutParamsWithHTTPClient creates a new PcloudVirtualserialnumberPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudVirtualserialnumberPutParamsWithHTTPClient(client *http.Client) *PcloudVirtualserialnumberPutParams { + return &PcloudVirtualserialnumberPutParams{ + HTTPClient: client, + } +} + +/* +PcloudVirtualserialnumberPutParams contains all the parameters to send to the API endpoint + + for the pcloud virtualserialnumber put operation. + + Typically these are written to a http.Request. +*/ +type PcloudVirtualserialnumberPutParams struct { + + /* Body. + + Parameters to edit description of a reserved Virtual Serial Number + */ + Body *models.UpdateVirtualSerialNumber + + /* VirtualSerialNumber. + + Virtual Serial Number + */ + VirtualSerialNumber string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud virtualserialnumber put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVirtualserialnumberPutParams) WithDefaults() *PcloudVirtualserialnumberPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud virtualserialnumber put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVirtualserialnumberPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud virtualserialnumber put params +func (o *PcloudVirtualserialnumberPutParams) WithTimeout(timeout time.Duration) *PcloudVirtualserialnumberPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud virtualserialnumber put params +func (o *PcloudVirtualserialnumberPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud virtualserialnumber put params +func (o *PcloudVirtualserialnumberPutParams) WithContext(ctx context.Context) *PcloudVirtualserialnumberPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud virtualserialnumber put params +func (o *PcloudVirtualserialnumberPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud virtualserialnumber put params +func (o *PcloudVirtualserialnumberPutParams) WithHTTPClient(client *http.Client) *PcloudVirtualserialnumberPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud virtualserialnumber put params +func (o *PcloudVirtualserialnumberPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud virtualserialnumber put params +func (o *PcloudVirtualserialnumberPutParams) WithBody(body *models.UpdateVirtualSerialNumber) *PcloudVirtualserialnumberPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud virtualserialnumber put params +func (o *PcloudVirtualserialnumberPutParams) SetBody(body *models.UpdateVirtualSerialNumber) { + o.Body = body +} + +// WithVirtualSerialNumber adds the virtualSerialNumber to the pcloud virtualserialnumber put params +func (o *PcloudVirtualserialnumberPutParams) WithVirtualSerialNumber(virtualSerialNumber string) *PcloudVirtualserialnumberPutParams { + o.SetVirtualSerialNumber(virtualSerialNumber) + return o +} + +// SetVirtualSerialNumber adds the virtualSerialNumber to the pcloud virtualserialnumber put params +func (o *PcloudVirtualserialnumberPutParams) SetVirtualSerialNumber(virtualSerialNumber string) { + o.VirtualSerialNumber = virtualSerialNumber +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudVirtualserialnumberPutParams) 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 virtual_serial_number + if err := r.SetPathParam("virtual_serial_number", o.VirtualSerialNumber); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_put_responses.go b/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_put_responses.go new file mode 100644 index 00000000..577d9f7c --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_put_responses.go @@ -0,0 +1,562 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_virtual_serial_number + +// 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" +) + +// PcloudVirtualserialnumberPutReader is a Reader for the PcloudVirtualserialnumberPut structure. +type PcloudVirtualserialnumberPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudVirtualserialnumberPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudVirtualserialnumberPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudVirtualserialnumberPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudVirtualserialnumberPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudVirtualserialnumberPutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudVirtualserialnumberPutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 410: + result := NewPcloudVirtualserialnumberPutGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudVirtualserialnumberPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /v1/virtual-serial-number/{virtual_serial_number}] pcloud.virtualserialnumber.put", response, response.Code()) + } +} + +// NewPcloudVirtualserialnumberPutOK creates a PcloudVirtualserialnumberPutOK with default headers values +func NewPcloudVirtualserialnumberPutOK() *PcloudVirtualserialnumberPutOK { + return &PcloudVirtualserialnumberPutOK{} +} + +/* +PcloudVirtualserialnumberPutOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudVirtualserialnumberPutOK struct { + Payload *models.GetServerVirtualSerialNumber +} + +// IsSuccess returns true when this pcloud virtualserialnumber put o k response has a 2xx status code +func (o *PcloudVirtualserialnumberPutOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this pcloud virtualserialnumber put o k response has a 3xx status code +func (o *PcloudVirtualserialnumberPutOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber put o k response has a 4xx status code +func (o *PcloudVirtualserialnumberPutOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud virtualserialnumber put o k response has a 5xx status code +func (o *PcloudVirtualserialnumberPutOK) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber put o k response a status code equal to that given +func (o *PcloudVirtualserialnumberPutOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the pcloud virtualserialnumber put o k response +func (o *PcloudVirtualserialnumberPutOK) Code() int { + return 200 +} + +func (o *PcloudVirtualserialnumberPutOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberPutOK %s", 200, payload) +} + +func (o *PcloudVirtualserialnumberPutOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberPutOK %s", 200, payload) +} + +func (o *PcloudVirtualserialnumberPutOK) GetPayload() *models.GetServerVirtualSerialNumber { + return o.Payload +} + +func (o *PcloudVirtualserialnumberPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GetServerVirtualSerialNumber) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudVirtualserialnumberPutBadRequest creates a PcloudVirtualserialnumberPutBadRequest with default headers values +func NewPcloudVirtualserialnumberPutBadRequest() *PcloudVirtualserialnumberPutBadRequest { + return &PcloudVirtualserialnumberPutBadRequest{} +} + +/* +PcloudVirtualserialnumberPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudVirtualserialnumberPutBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber put bad request response has a 2xx status code +func (o *PcloudVirtualserialnumberPutBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber put bad request response has a 3xx status code +func (o *PcloudVirtualserialnumberPutBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber put bad request response has a 4xx status code +func (o *PcloudVirtualserialnumberPutBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud virtualserialnumber put bad request response has a 5xx status code +func (o *PcloudVirtualserialnumberPutBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber put bad request response a status code equal to that given +func (o *PcloudVirtualserialnumberPutBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the pcloud virtualserialnumber put bad request response +func (o *PcloudVirtualserialnumberPutBadRequest) Code() int { + return 400 +} + +func (o *PcloudVirtualserialnumberPutBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberPutBadRequest %s", 400, payload) +} + +func (o *PcloudVirtualserialnumberPutBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberPutBadRequest %s", 400, payload) +} + +func (o *PcloudVirtualserialnumberPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberPutBadRequest) 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 +} + +// NewPcloudVirtualserialnumberPutUnauthorized creates a PcloudVirtualserialnumberPutUnauthorized with default headers values +func NewPcloudVirtualserialnumberPutUnauthorized() *PcloudVirtualserialnumberPutUnauthorized { + return &PcloudVirtualserialnumberPutUnauthorized{} +} + +/* +PcloudVirtualserialnumberPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudVirtualserialnumberPutUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber put unauthorized response has a 2xx status code +func (o *PcloudVirtualserialnumberPutUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber put unauthorized response has a 3xx status code +func (o *PcloudVirtualserialnumberPutUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber put unauthorized response has a 4xx status code +func (o *PcloudVirtualserialnumberPutUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud virtualserialnumber put unauthorized response has a 5xx status code +func (o *PcloudVirtualserialnumberPutUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber put unauthorized response a status code equal to that given +func (o *PcloudVirtualserialnumberPutUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the pcloud virtualserialnumber put unauthorized response +func (o *PcloudVirtualserialnumberPutUnauthorized) Code() int { + return 401 +} + +func (o *PcloudVirtualserialnumberPutUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberPutUnauthorized %s", 401, payload) +} + +func (o *PcloudVirtualserialnumberPutUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberPutUnauthorized %s", 401, payload) +} + +func (o *PcloudVirtualserialnumberPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberPutUnauthorized) 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 +} + +// NewPcloudVirtualserialnumberPutForbidden creates a PcloudVirtualserialnumberPutForbidden with default headers values +func NewPcloudVirtualserialnumberPutForbidden() *PcloudVirtualserialnumberPutForbidden { + return &PcloudVirtualserialnumberPutForbidden{} +} + +/* +PcloudVirtualserialnumberPutForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudVirtualserialnumberPutForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber put forbidden response has a 2xx status code +func (o *PcloudVirtualserialnumberPutForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber put forbidden response has a 3xx status code +func (o *PcloudVirtualserialnumberPutForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber put forbidden response has a 4xx status code +func (o *PcloudVirtualserialnumberPutForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud virtualserialnumber put forbidden response has a 5xx status code +func (o *PcloudVirtualserialnumberPutForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber put forbidden response a status code equal to that given +func (o *PcloudVirtualserialnumberPutForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the pcloud virtualserialnumber put forbidden response +func (o *PcloudVirtualserialnumberPutForbidden) Code() int { + return 403 +} + +func (o *PcloudVirtualserialnumberPutForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberPutForbidden %s", 403, payload) +} + +func (o *PcloudVirtualserialnumberPutForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberPutForbidden %s", 403, payload) +} + +func (o *PcloudVirtualserialnumberPutForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberPutForbidden) 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 +} + +// NewPcloudVirtualserialnumberPutNotFound creates a PcloudVirtualserialnumberPutNotFound with default headers values +func NewPcloudVirtualserialnumberPutNotFound() *PcloudVirtualserialnumberPutNotFound { + return &PcloudVirtualserialnumberPutNotFound{} +} + +/* +PcloudVirtualserialnumberPutNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudVirtualserialnumberPutNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber put not found response has a 2xx status code +func (o *PcloudVirtualserialnumberPutNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber put not found response has a 3xx status code +func (o *PcloudVirtualserialnumberPutNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber put not found response has a 4xx status code +func (o *PcloudVirtualserialnumberPutNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud virtualserialnumber put not found response has a 5xx status code +func (o *PcloudVirtualserialnumberPutNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber put not found response a status code equal to that given +func (o *PcloudVirtualserialnumberPutNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the pcloud virtualserialnumber put not found response +func (o *PcloudVirtualserialnumberPutNotFound) Code() int { + return 404 +} + +func (o *PcloudVirtualserialnumberPutNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberPutNotFound %s", 404, payload) +} + +func (o *PcloudVirtualserialnumberPutNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberPutNotFound %s", 404, payload) +} + +func (o *PcloudVirtualserialnumberPutNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberPutNotFound) 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 +} + +// NewPcloudVirtualserialnumberPutGone creates a PcloudVirtualserialnumberPutGone with default headers values +func NewPcloudVirtualserialnumberPutGone() *PcloudVirtualserialnumberPutGone { + return &PcloudVirtualserialnumberPutGone{} +} + +/* +PcloudVirtualserialnumberPutGone describes a response with status code 410, with default header values. + +Gone +*/ +type PcloudVirtualserialnumberPutGone struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber put gone response has a 2xx status code +func (o *PcloudVirtualserialnumberPutGone) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber put gone response has a 3xx status code +func (o *PcloudVirtualserialnumberPutGone) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber put gone response has a 4xx status code +func (o *PcloudVirtualserialnumberPutGone) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud virtualserialnumber put gone response has a 5xx status code +func (o *PcloudVirtualserialnumberPutGone) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud virtualserialnumber put gone response a status code equal to that given +func (o *PcloudVirtualserialnumberPutGone) IsCode(code int) bool { + return code == 410 +} + +// Code gets the status code for the pcloud virtualserialnumber put gone response +func (o *PcloudVirtualserialnumberPutGone) Code() int { + return 410 +} + +func (o *PcloudVirtualserialnumberPutGone) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberPutGone %s", 410, payload) +} + +func (o *PcloudVirtualserialnumberPutGone) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberPutGone %s", 410, payload) +} + +func (o *PcloudVirtualserialnumberPutGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberPutGone) 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 +} + +// NewPcloudVirtualserialnumberPutInternalServerError creates a PcloudVirtualserialnumberPutInternalServerError with default headers values +func NewPcloudVirtualserialnumberPutInternalServerError() *PcloudVirtualserialnumberPutInternalServerError { + return &PcloudVirtualserialnumberPutInternalServerError{} +} + +/* +PcloudVirtualserialnumberPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudVirtualserialnumberPutInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud virtualserialnumber put internal server error response has a 2xx status code +func (o *PcloudVirtualserialnumberPutInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud virtualserialnumber put internal server error response has a 3xx status code +func (o *PcloudVirtualserialnumberPutInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud virtualserialnumber put internal server error response has a 4xx status code +func (o *PcloudVirtualserialnumberPutInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud virtualserialnumber put internal server error response has a 5xx status code +func (o *PcloudVirtualserialnumberPutInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this pcloud virtualserialnumber put internal server error response a status code equal to that given +func (o *PcloudVirtualserialnumberPutInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the pcloud virtualserialnumber put internal server error response +func (o *PcloudVirtualserialnumberPutInternalServerError) Code() int { + return 500 +} + +func (o *PcloudVirtualserialnumberPutInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberPutInternalServerError %s", 500, payload) +} + +func (o *PcloudVirtualserialnumberPutInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/virtual-serial-number/{virtual_serial_number}][%d] pcloudVirtualserialnumberPutInternalServerError %s", 500, payload) +} + +func (o *PcloudVirtualserialnumberPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVirtualserialnumberPutInternalServerError) 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 6a25d818..b5d52b9b 100644 --- a/power/client/power_iaas_api_client.go +++ b/power/client/power_iaas_api_client.go @@ -22,6 +22,7 @@ import ( "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/network_address_groups" + "github.com/IBM-Cloud/power-go-client/power/client/network_peers" "github.com/IBM-Cloud/power-go-client/power/client/network_security_groups" "github.com/IBM-Cloud/power-go-client/power/client/networks" "github.com/IBM-Cloud/power-go-client/power/client/open_stacks" @@ -48,6 +49,7 @@ import ( "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys" "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections" "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_virtual_serial_number" "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volume_groups" "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volume_onboarding" "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes" @@ -114,6 +116,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *PowerIaasA cli.InternalStorageRegions = internal_storage_regions.New(transport, formats) cli.InternalTransitGateway = internal_transit_gateway.New(transport, formats) cli.NetworkAddressGroups = network_address_groups.New(transport, formats) + cli.NetworkPeers = network_peers.New(transport, formats) cli.NetworkSecurityGroups = network_security_groups.New(transport, formats) cli.Networks = networks.New(transport, formats) cli.OpenStacks = open_stacks.New(transport, formats) @@ -140,6 +143,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *PowerIaasA cli.PCloudTenantsSSHKeys = p_cloud_tenants_ssh_keys.New(transport, formats) cli.PCloudvpnConnections = p_cloud_v_p_n_connections.New(transport, formats) cli.PCloudvpnPolicies = p_cloud_v_p_n_policies.New(transport, formats) + cli.PCloudVirtualSerialNumber = p_cloud_virtual_serial_number.New(transport, formats) cli.PCloudVolumeGroups = p_cloud_volume_groups.New(transport, formats) cli.PCloudVolumeOnboarding = p_cloud_volume_onboarding.New(transport, formats) cli.PCloudVolumes = p_cloud_volumes.New(transport, formats) @@ -218,6 +222,8 @@ type PowerIaasAPI struct { NetworkAddressGroups network_address_groups.ClientService + NetworkPeers network_peers.ClientService + NetworkSecurityGroups network_security_groups.ClientService Networks networks.ClientService @@ -270,6 +276,8 @@ type PowerIaasAPI struct { PCloudvpnPolicies p_cloud_v_p_n_policies.ClientService + PCloudVirtualSerialNumber p_cloud_virtual_serial_number.ClientService + PCloudVolumeGroups p_cloud_volume_groups.ClientService PCloudVolumeOnboarding p_cloud_volume_onboarding.ClientService @@ -308,6 +316,7 @@ func (c *PowerIaasAPI) SetTransport(transport runtime.ClientTransport) { c.InternalStorageRegions.SetTransport(transport) c.InternalTransitGateway.SetTransport(transport) c.NetworkAddressGroups.SetTransport(transport) + c.NetworkPeers.SetTransport(transport) c.NetworkSecurityGroups.SetTransport(transport) c.Networks.SetTransport(transport) c.OpenStacks.SetTransport(transport) @@ -334,6 +343,7 @@ func (c *PowerIaasAPI) SetTransport(transport runtime.ClientTransport) { c.PCloudTenantsSSHKeys.SetTransport(transport) c.PCloudvpnConnections.SetTransport(transport) c.PCloudvpnPolicies.SetTransport(transport) + c.PCloudVirtualSerialNumber.SetTransport(transport) c.PCloudVolumeGroups.SetTransport(transport) c.PCloudVolumeOnboarding.SetTransport(transport) c.PCloudVolumes.SetTransport(transport) diff --git a/power/models/access_config.go b/power/models/access_config.go index a7cc67e9..1761bf0b 100644 --- a/power/models/access_config.go +++ b/power/models/access_config.go @@ -14,7 +14,8 @@ import ( "github.com/go-openapi/validate" ) -// AccessConfig Network communication configuration (for satellite locations only) +// AccessConfig (deprecated - replaced by network peer id) +// Network communication configuration (for satellite locations only) // - `internal-only` - network is only used for internal host communication // - `outbound-only` - network will be capable of egress traffic // - `bidirectional-static-route` - network will be capable of ingress and egress traffic via static routes diff --git a/power/models/add_server_virtual_serial_number.go b/power/models/add_server_virtual_serial_number.go new file mode 100644 index 00000000..03706926 --- /dev/null +++ b/power/models/add_server_virtual_serial_number.go @@ -0,0 +1,74 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// AddServerVirtualSerialNumber add server virtual serial number +// +// swagger:model AddServerVirtualSerialNumber +type AddServerVirtualSerialNumber struct { + + // Description of the Virtual Serial Number + Description string `json:"description,omitempty"` + + // Provide an existing reserved Virtual Serial Number or specify 'auto-assign' for auto generated Virtual Serial Number. + // Required: true + Serial *string `json:"serial"` +} + +// Validate validates this add server virtual serial number +func (m *AddServerVirtualSerialNumber) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSerial(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AddServerVirtualSerialNumber) validateSerial(formats strfmt.Registry) error { + + if err := validate.Required("serial", "body", m.Serial); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this add server virtual serial number based on context it is used +func (m *AddServerVirtualSerialNumber) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *AddServerVirtualSerialNumber) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AddServerVirtualSerialNumber) UnmarshalBinary(b []byte) error { + var res AddServerVirtualSerialNumber + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/create_server_virtual_serial_number.go b/power/models/create_server_virtual_serial_number.go new file mode 100644 index 00000000..d01b210d --- /dev/null +++ b/power/models/create_server_virtual_serial_number.go @@ -0,0 +1,74 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// CreateServerVirtualSerialNumber create server virtual serial number +// +// swagger:model CreateServerVirtualSerialNumber +type CreateServerVirtualSerialNumber struct { + + // Description of the Virtual Serial Number + Description string `json:"description,omitempty"` + + // Provide an existing reserved Virtual Serial Number or specify 'auto-assign' for auto generated Virtual Serial Number. + // Required: true + Serial *string `json:"serial"` +} + +// Validate validates this create server virtual serial number +func (m *CreateServerVirtualSerialNumber) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSerial(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateServerVirtualSerialNumber) validateSerial(formats strfmt.Registry) error { + + if err := validate.Required("serial", "body", m.Serial); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this create server virtual serial number based on context it is used +func (m *CreateServerVirtualSerialNumber) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CreateServerVirtualSerialNumber) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CreateServerVirtualSerialNumber) UnmarshalBinary(b []byte) error { + var res CreateServerVirtualSerialNumber + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/delete_server_virtual_serial_number.go b/power/models/delete_server_virtual_serial_number.go new file mode 100644 index 00000000..e3c68969 --- /dev/null +++ b/power/models/delete_server_virtual_serial_number.go @@ -0,0 +1,50 @@ +// 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" +) + +// DeleteServerVirtualSerialNumber delete server virtual serial number +// +// swagger:model DeleteServerVirtualSerialNumber +type DeleteServerVirtualSerialNumber struct { + + // Indicates if the Virtual Serial Number attached to a PVM Instance is reserved or not + RetainVSN bool `json:"retainVSN,omitempty"` +} + +// Validate validates this delete server virtual serial number +func (m *DeleteServerVirtualSerialNumber) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this delete server virtual serial number based on context it is used +func (m *DeleteServerVirtualSerialNumber) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *DeleteServerVirtualSerialNumber) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DeleteServerVirtualSerialNumber) UnmarshalBinary(b []byte) error { + var res DeleteServerVirtualSerialNumber + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/get_server_virtual_serial_number.go b/power/models/get_server_virtual_serial_number.go new file mode 100644 index 00000000..f0b33a0e --- /dev/null +++ b/power/models/get_server_virtual_serial_number.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// GetServerVirtualSerialNumber get server virtual serial number +// +// swagger:model GetServerVirtualSerialNumber +type GetServerVirtualSerialNumber struct { + + // Description of the Virtual Serial Number + // Required: true + Description *string `json:"description"` + + // Provide an existing reserved Virtual Serial Number or specify 'auto-assign' for auto generated Virtual Serial Number. + // Required: true + Serial *string `json:"serial"` +} + +// Validate validates this get server virtual serial number +func (m *GetServerVirtualSerialNumber) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSerial(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetServerVirtualSerialNumber) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *GetServerVirtualSerialNumber) validateSerial(formats strfmt.Registry) error { + + if err := validate.Required("serial", "body", m.Serial); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this get server virtual serial number based on context it is used +func (m *GetServerVirtualSerialNumber) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *GetServerVirtualSerialNumber) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GetServerVirtualSerialNumber) UnmarshalBinary(b []byte) error { + var res GetServerVirtualSerialNumber + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/host.go b/power/models/host.go index d1a86cc8..fe859e82 100644 --- a/power/models/host.go +++ b/power/models/host.go @@ -30,6 +30,9 @@ type Host struct { // Information about the owning host group HostGroup *HostGroupSummary `json:"hostGroup,omitempty"` + // current physical ID of the host. Keep internal + HostReference int64 `json:"hostReference,omitempty"` + // ID of the host ID string `json:"id,omitempty"` diff --git a/power/models/network.go b/power/models/network.go index 5e5d2153..d6a16ba1 100644 --- a/power/models/network.go +++ b/power/models/network.go @@ -64,10 +64,16 @@ type Network struct { // Required: true Name *string `json:"name"` + // network address translation + NetworkAddressTranslation *NetworkAddressTranslation `json:"networkAddressTranslation,omitempty"` + // Unique Network ID // Required: true NetworkID *string `json:"networkID"` + // Network Peer ID + PeerID string `json:"peerID,omitempty"` + // Public IP Address Ranges (for pub-vlan networks) PublicIPAddressRanges []*IPAddressRange `json:"publicIPAddressRanges,omitempty"` @@ -120,6 +126,10 @@ func (m *Network) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateNetworkAddressTranslation(formats); err != nil { + res = append(res, err) + } + if err := m.validateNetworkID(formats); err != nil { res = append(res, err) } @@ -275,6 +285,25 @@ func (m *Network) validateName(formats strfmt.Registry) error { return nil } +func (m *Network) validateNetworkAddressTranslation(formats strfmt.Registry) error { + if swag.IsZero(m.NetworkAddressTranslation) { // not required + return nil + } + + if m.NetworkAddressTranslation != nil { + if err := m.NetworkAddressTranslation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networkAddressTranslation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networkAddressTranslation") + } + return err + } + } + + return nil +} + func (m *Network) validateNetworkID(formats strfmt.Registry) error { if err := validate.Required("networkID", "body", m.NetworkID); err != nil { @@ -385,6 +414,10 @@ func (m *Network) ContextValidate(ctx context.Context, formats strfmt.Registry) res = append(res, err) } + if err := m.contextValidateNetworkAddressTranslation(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidatePublicIPAddressRanges(ctx, formats); err != nil { res = append(res, err) } @@ -480,6 +513,27 @@ func (m *Network) contextValidateIPAddressRanges(ctx context.Context, formats st return nil } +func (m *Network) contextValidateNetworkAddressTranslation(ctx context.Context, formats strfmt.Registry) error { + + if m.NetworkAddressTranslation != nil { + + if swag.IsZero(m.NetworkAddressTranslation) { // not required + return nil + } + + if err := m.NetworkAddressTranslation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networkAddressTranslation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networkAddressTranslation") + } + return err + } + } + + return nil +} + func (m *Network) contextValidatePublicIPAddressRanges(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.PublicIPAddressRanges); i++ { diff --git a/power/models/network_address_translation.go b/power/models/network_address_translation.go new file mode 100644 index 00000000..cd7eaca7 --- /dev/null +++ b/power/models/network_address_translation.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" +) + +// NetworkAddressTranslation Contains the Network Address Translation Details +// +// swagger:model NetworkAddressTranslation +type NetworkAddressTranslation struct { + + // source IP address, required if network peer type is L3BGP + // or L3STATIC and if Network Address Translation (NAT) is + // enabled + // + SourceIP string `json:"sourceIP,omitempty"` +} + +// Validate validates this network address translation +func (m *NetworkAddressTranslation) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this network address translation based on context it is used +func (m *NetworkAddressTranslation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkAddressTranslation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkAddressTranslation) UnmarshalBinary(b []byte) error { + var res NetworkAddressTranslation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_create.go b/power/models/network_create.go index 21508e23..3aaa8c1b 100644 --- a/power/models/network_create.go +++ b/power/models/network_create.go @@ -17,7 +17,7 @@ import ( ) // NetworkCreate network create -// Example: {"accessConfig":"internal-only","cidr":"192.168.1.0/24","gateway":"192.168.1.1","ipAddressRanges":[{"endingIPAddress":"192.168.1.254","startingIPAddress":"192.168.1.2"}],"mtu":1450,"name":"sample-network","type":"vlan"} +// Example: {"cidr":"192.168.1.0/24","gateway":"192.168.1.1","ipAddressRanges":[{"endingIPAddress":"192.168.1.254","startingIPAddress":"192.168.1.2"}],"mtu":1450,"name":"sample-network","type":"vlan"} // // swagger:model NetworkCreate type NetworkCreate struct { @@ -48,6 +48,9 @@ type NetworkCreate struct { // Network Name Name string `json:"name,omitempty"` + // Network Peer information + Peer *NetworkCreatePeer `json:"peer,omitempty"` + // Type of Network - 'vlan' (private network) 'pub-vlan' (public network) 'dhcp-vlan' (for satellite locations only) // Required: true // Enum: ["vlan","pub-vlan","dhcp-vlan"] @@ -73,6 +76,10 @@ func (m *NetworkCreate) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validatePeer(formats); err != nil { + res = append(res, err) + } + if err := m.validateType(formats); err != nil { res = append(res, err) } @@ -146,6 +153,25 @@ func (m *NetworkCreate) validateMtu(formats strfmt.Registry) error { return nil } +func (m *NetworkCreate) validatePeer(formats strfmt.Registry) error { + if swag.IsZero(m.Peer) { // not required + return nil + } + + if m.Peer != nil { + if err := m.Peer.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peer") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peer") + } + return err + } + } + + return nil +} + var networkCreateTypeTypePropEnum []interface{} func init() { @@ -221,6 +247,10 @@ func (m *NetworkCreate) ContextValidate(ctx context.Context, formats strfmt.Regi res = append(res, err) } + if err := m.contextValidatePeer(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateUserTags(ctx, formats); err != nil { res = append(res, err) } @@ -274,6 +304,27 @@ func (m *NetworkCreate) contextValidateIPAddressRanges(ctx context.Context, form return nil } +func (m *NetworkCreate) contextValidatePeer(ctx context.Context, formats strfmt.Registry) error { + + if m.Peer != nil { + + if swag.IsZero(m.Peer) { // not required + return nil + } + + if err := m.Peer.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peer") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peer") + } + return err + } + } + + return nil +} + func (m *NetworkCreate) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { if err := m.UserTags.ContextValidate(ctx, formats); err != nil { diff --git a/power/models/network_create_peer.go b/power/models/network_create_peer.go new file mode 100644 index 00000000..09c0e443 --- /dev/null +++ b/power/models/network_create_peer.go @@ -0,0 +1,173 @@ +// 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" +) + +// NetworkCreatePeer network create peer +// +// swagger:model NetworkCreatePeer +type NetworkCreatePeer struct { + + // ID of the network peer + // Required: true + ID *string `json:"id"` + + // network address translation + NetworkAddressTranslation *NetworkAddressTranslation `json:"networkAddressTranslation,omitempty"` + + // type + Type NetworkPeerType `json:"type,omitempty"` +} + +// Validate validates this network create peer +func (m *NetworkCreatePeer) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNetworkAddressTranslation(formats); err != nil { + res = append(res, err) + } + + if err := m.validateType(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkCreatePeer) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *NetworkCreatePeer) validateNetworkAddressTranslation(formats strfmt.Registry) error { + if swag.IsZero(m.NetworkAddressTranslation) { // not required + return nil + } + + if m.NetworkAddressTranslation != nil { + if err := m.NetworkAddressTranslation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networkAddressTranslation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networkAddressTranslation") + } + return err + } + } + + return nil +} + +func (m *NetworkCreatePeer) validateType(formats strfmt.Registry) error { + if swag.IsZero(m.Type) { // not required + return nil + } + + if err := m.Type.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("type") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("type") + } + return err + } + + return nil +} + +// ContextValidate validate this network create peer based on the context it is used +func (m *NetworkCreatePeer) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateNetworkAddressTranslation(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateType(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkCreatePeer) contextValidateNetworkAddressTranslation(ctx context.Context, formats strfmt.Registry) error { + + if m.NetworkAddressTranslation != nil { + + if swag.IsZero(m.NetworkAddressTranslation) { // not required + return nil + } + + if err := m.NetworkAddressTranslation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networkAddressTranslation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networkAddressTranslation") + } + return err + } + } + + return nil +} + +func (m *NetworkCreatePeer) contextValidateType(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Type) { // not required + return nil + } + + if err := m.Type.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("type") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("type") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkCreatePeer) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkCreatePeer) UnmarshalBinary(b []byte) error { + var res NetworkCreatePeer + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_peer.go b/power/models/network_peer.go new file mode 100644 index 00000000..2ecb6681 --- /dev/null +++ b/power/models/network_peer.go @@ -0,0 +1,163 @@ +// 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" +) + +// NetworkPeer network peer +// +// swagger:model NetworkPeer +type NetworkPeer struct { + + // Description of the network peer + // Required: true + Description *string `json:"description"` + + // ID of the network peer + // Required: true + ID *string `json:"id"` + + // Name of the network peer + // Required: true + Name *string `json:"name"` + + // type + // Required: true + Type *NetworkPeerType `json:"type"` +} + +// Validate validates this network peer +func (m *NetworkPeer) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateType(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkPeer) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *NetworkPeer) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *NetworkPeer) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *NetworkPeer) validateType(formats strfmt.Registry) error { + + if err := validate.Required("type", "body", m.Type); err != nil { + return err + } + + if err := validate.Required("type", "body", m.Type); err != nil { + return err + } + + if m.Type != nil { + if err := m.Type.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("type") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("type") + } + return err + } + } + + return nil +} + +// ContextValidate validate this network peer based on the context it is used +func (m *NetworkPeer) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateType(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkPeer) contextValidateType(ctx context.Context, formats strfmt.Registry) error { + + if m.Type != nil { + + if err := m.Type.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("type") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("type") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkPeer) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkPeer) UnmarshalBinary(b []byte) error { + var res NetworkPeer + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_peer_type.go b/power/models/network_peer_type.go new file mode 100644 index 00000000..d47fb443 --- /dev/null +++ b/power/models/network_peer_type.go @@ -0,0 +1,81 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// NetworkPeerType Type of the network peer +// +// swagger:model NetworkPeerType +type NetworkPeerType string + +func NewNetworkPeerType(value NetworkPeerType) *NetworkPeerType { + return &value +} + +// Pointer returns a pointer to a freshly-allocated NetworkPeerType. +func (m NetworkPeerType) Pointer() *NetworkPeerType { + return &m +} + +const ( + + // NetworkPeerTypeL2 captures enum value "L2" + NetworkPeerTypeL2 NetworkPeerType = "L2" + + // NetworkPeerTypeL3BGP captures enum value "L3BGP" + NetworkPeerTypeL3BGP NetworkPeerType = "L3BGP" + + // NetworkPeerTypeL3Static captures enum value "L3Static" + NetworkPeerTypeL3Static NetworkPeerType = "L3Static" +) + +// for schema +var networkPeerTypeEnum []interface{} + +func init() { + var res []NetworkPeerType + if err := json.Unmarshal([]byte(`["L2","L3BGP","L3Static"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkPeerTypeEnum = append(networkPeerTypeEnum, v) + } +} + +func (m NetworkPeerType) validateNetworkPeerTypeEnum(path, location string, value NetworkPeerType) error { + if err := validate.EnumCase(path, location, value, networkPeerTypeEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this network peer type +func (m NetworkPeerType) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateNetworkPeerTypeEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this network peer type based on context it is used +func (m NetworkPeerType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/power/models/network_peers.go b/power/models/network_peers.go new file mode 100644 index 00000000..38a9e556 --- /dev/null +++ b/power/models/network_peers.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" +) + +// NetworkPeers network peers +// +// swagger:model NetworkPeers +type NetworkPeers struct { + + // List of network peers + // Required: true + NetworkPeers []*NetworkPeer `json:"networkPeers"` +} + +// Validate validates this network peers +func (m *NetworkPeers) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateNetworkPeers(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkPeers) validateNetworkPeers(formats strfmt.Registry) error { + + if err := validate.Required("networkPeers", "body", m.NetworkPeers); err != nil { + return err + } + + for i := 0; i < len(m.NetworkPeers); i++ { + if swag.IsZero(m.NetworkPeers[i]) { // not required + continue + } + + if m.NetworkPeers[i] != nil { + if err := m.NetworkPeers[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networkPeers" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networkPeers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this network peers based on the context it is used +func (m *NetworkPeers) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateNetworkPeers(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkPeers) contextValidateNetworkPeers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.NetworkPeers); i++ { + + if m.NetworkPeers[i] != nil { + + if swag.IsZero(m.NetworkPeers[i]) { // not required + return nil + } + + if err := m.NetworkPeers[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networkPeers" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networkPeers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkPeers) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkPeers) UnmarshalBinary(b []byte) error { + var res NetworkPeers + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_reference.go b/power/models/network_reference.go index a912a1e4..85784eb4 100644 --- a/power/models/network_reference.go +++ b/power/models/network_reference.go @@ -49,6 +49,9 @@ type NetworkReference struct { // Required: true NetworkID *string `json:"networkID"` + // Network Peer ID + PeerID string `json:"peerID,omitempty"` + // Type of Network - 'vlan' (private network) 'pub-vlan' (public network) 'dhcp-vlan' (for satellite locations only) // Required: true // Enum: ["vlan","pub-vlan","dhcp-vlan"] diff --git a/power/models/p_vm_instance.go b/power/models/p_vm_instance.go index 457affd7..5725b1ec 100644 --- a/power/models/p_vm_instance.go +++ b/power/models/p_vm_instance.go @@ -164,6 +164,9 @@ type PVMInstance struct { // The pvm instance virtual CPU information VirtualCores *VirtualCores `json:"virtualCores,omitempty"` + // Information about Virtual Serial Number assigned to the PVM Instance + VirtualSerialNumber *GetServerVirtualSerialNumber `json:"virtualSerialNumber,omitempty"` + // List of volume IDs // Required: true VolumeIDs []string `json:"volumeIDs"` @@ -269,6 +272,10 @@ func (m *PVMInstance) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateVirtualSerialNumber(formats); err != nil { + res = append(res, err) + } + if err := m.validateVolumeIDs(formats); err != nil { res = append(res, err) } @@ -672,6 +679,25 @@ func (m *PVMInstance) validateVirtualCores(formats strfmt.Registry) error { return nil } +func (m *PVMInstance) validateVirtualSerialNumber(formats strfmt.Registry) error { + if swag.IsZero(m.VirtualSerialNumber) { // not required + return nil + } + + if m.VirtualSerialNumber != nil { + if err := m.VirtualSerialNumber.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualSerialNumber") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualSerialNumber") + } + return err + } + } + + return nil +} + func (m *PVMInstance) validateVolumeIDs(formats strfmt.Registry) error { if err := validate.Required("volumeIDs", "body", m.VolumeIDs); err != nil { @@ -729,6 +755,10 @@ func (m *PVMInstance) ContextValidate(ctx context.Context, formats strfmt.Regist res = append(res, err) } + if err := m.contextValidateVirtualSerialNumber(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -972,6 +1002,27 @@ func (m *PVMInstance) contextValidateVirtualCores(ctx context.Context, formats s return nil } +func (m *PVMInstance) contextValidateVirtualSerialNumber(ctx context.Context, formats strfmt.Registry) error { + + if m.VirtualSerialNumber != nil { + + if swag.IsZero(m.VirtualSerialNumber) { // not required + return nil + } + + if err := m.VirtualSerialNumber.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualSerialNumber") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualSerialNumber") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PVMInstance) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/p_vm_instance_create.go b/power/models/p_vm_instance_create.go index a44538bb..06711a8d 100644 --- a/power/models/p_vm_instance_create.go +++ b/power/models/p_vm_instance_create.go @@ -106,7 +106,7 @@ type PVMInstanceCreate struct { // Storage Pool for server deployment; if provided then storageAffinity will be ignored; Only valid when you deploy one of the IBM supplied stock images. Storage pool for a custom image (an imported image or an image that is created from a PVMInstance capture) defaults to the storage pool the image was created in StoragePool string `json:"storagePool,omitempty"` - // Indicates if all volumes attached to the server must reside in the same storage pool; If set to false then volumes from any storage type and pool can be attached to the PVMInstance; Impacts PVMInstance snapshot, capture, and clone, for capture and clone - only data volumes that are of the same storage type and in the same storage pool of the PVMInstance's boot volume can be included; for snapshot - all data volumes to be included in the snapshot must reside in the same storage type and pool. Once set to false, cannot be set back to true unless all volumes attached reside in the same storage type and pool. + // Indicates if all volumes attached to the PVMInstance must reside in the same storage pool. If set to false, volumes from any storage pool can be attached to the PVMInstance. This flag only impacts PVMInstance snapshot and capture operations. For capture, only volumes that reside in the same storage pool as the PVMInstance's boot volume can be included. For snapshots, all volumes included in the snapshot must reside in the same storage pool. StoragePoolAffinity *bool `json:"storagePoolAffinity,omitempty"` // Storage type for server deployment; if storageType is not provided the storage type will default to 'tier3'. @@ -124,6 +124,9 @@ type PVMInstanceCreate struct { // The pvm instance virtual CPU information VirtualCores *VirtualCores `json:"virtualCores,omitempty"` + // Virtual Serial Number information + VirtualSerialNumber *CreateServerVirtualSerialNumber `json:"virtualSerialNumber,omitempty"` + // List of volume IDs VolumeIDs []string `json:"volumeIDs"` } @@ -196,6 +199,10 @@ func (m *PVMInstanceCreate) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateVirtualSerialNumber(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -591,6 +598,25 @@ func (m *PVMInstanceCreate) validateVirtualCores(formats strfmt.Registry) error return nil } +func (m *PVMInstanceCreate) validateVirtualSerialNumber(formats strfmt.Registry) error { + if swag.IsZero(m.VirtualSerialNumber) { // not required + return nil + } + + if m.VirtualSerialNumber != nil { + if err := m.VirtualSerialNumber.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualSerialNumber") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualSerialNumber") + } + return err + } + } + + return nil +} + // ContextValidate validate this p VM instance create based on the context it is used func (m *PVMInstanceCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -623,6 +649,10 @@ func (m *PVMInstanceCreate) ContextValidate(ctx context.Context, formats strfmt. res = append(res, err) } + if err := m.contextValidateVirtualSerialNumber(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -770,6 +800,27 @@ func (m *PVMInstanceCreate) contextValidateVirtualCores(ctx context.Context, for return nil } +func (m *PVMInstanceCreate) contextValidateVirtualSerialNumber(ctx context.Context, formats strfmt.Registry) error { + + if m.VirtualSerialNumber != nil { + + if swag.IsZero(m.VirtualSerialNumber) { // not required + return nil + } + + if err := m.VirtualSerialNumber.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualSerialNumber") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualSerialNumber") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PVMInstanceCreate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/p_vm_instance_delete.go b/power/models/p_vm_instance_delete.go new file mode 100644 index 00000000..59adfdcb --- /dev/null +++ b/power/models/p_vm_instance_delete.go @@ -0,0 +1,50 @@ +// 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" +) + +// PVMInstanceDelete p VM instance delete +// +// swagger:model PVMInstanceDelete +type PVMInstanceDelete struct { + + // Indicates if the Virtual Serial Number attached to a PVM Instance is reserved or not + RetainVSN *bool `json:"retainVSN,omitempty"` +} + +// Validate validates this p VM instance delete +func (m *PVMInstanceDelete) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this p VM instance delete based on context it is used +func (m *PVMInstanceDelete) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PVMInstanceDelete) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PVMInstanceDelete) UnmarshalBinary(b []byte) error { + var res PVMInstanceDelete + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/p_vm_instance_network.go b/power/models/p_vm_instance_network.go index 94e64264..31ad9e4a 100644 --- a/power/models/p_vm_instance_network.go +++ b/power/models/p_vm_instance_network.go @@ -35,9 +35,15 @@ type PVMInstanceNetwork struct { // ID of the network NetworkID string `json:"networkID,omitempty"` + // ID of the network interface + NetworkInterfaceID string `json:"networkInterfaceID,omitempty"` + // The name of the network the address is on NetworkName string `json:"networkName,omitempty"` + // Links to the network security groups that the network interface is a member of + NetworkSecurityGroupsHref []string `json:"networkSecurityGroupsHref,omitempty"` + // The address type (fixed or dynamic) Type string `json:"type,omitempty"` diff --git a/power/models/p_vm_instance_reference.go b/power/models/p_vm_instance_reference.go index d15a4159..3ff22932 100644 --- a/power/models/p_vm_instance_reference.go +++ b/power/models/p_vm_instance_reference.go @@ -153,6 +153,9 @@ type PVMInstanceReference struct { // The pvm instance virtual CPU information VirtualCores *VirtualCores `json:"virtualCores,omitempty"` + + // Information about Virtual Serial Number assigned to the PVM Instance + VirtualSerialNumber *GetServerVirtualSerialNumber `json:"virtualSerialNumber,omitempty"` } // Validate validates this p VM instance reference @@ -247,6 +250,10 @@ func (m *PVMInstanceReference) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateVirtualSerialNumber(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -617,6 +624,25 @@ func (m *PVMInstanceReference) validateVirtualCores(formats strfmt.Registry) err return nil } +func (m *PVMInstanceReference) validateVirtualSerialNumber(formats strfmt.Registry) error { + if swag.IsZero(m.VirtualSerialNumber) { // not required + return nil + } + + if m.VirtualSerialNumber != nil { + if err := m.VirtualSerialNumber.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualSerialNumber") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualSerialNumber") + } + return err + } + } + + return nil +} + // ContextValidate validate this p VM instance reference based on the context it is used func (m *PVMInstanceReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -661,6 +687,10 @@ func (m *PVMInstanceReference) ContextValidate(ctx context.Context, formats strf res = append(res, err) } + if err := m.contextValidateVirtualSerialNumber(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -890,6 +920,27 @@ func (m *PVMInstanceReference) contextValidateVirtualCores(ctx context.Context, return nil } +func (m *PVMInstanceReference) contextValidateVirtualSerialNumber(ctx context.Context, formats strfmt.Registry) error { + + if m.VirtualSerialNumber != nil { + + if swag.IsZero(m.VirtualSerialNumber) { // not required + return nil + } + + if err := m.VirtualSerialNumber.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualSerialNumber") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualSerialNumber") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PVMInstanceReference) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/p_vm_instance_reference_v2.go b/power/models/p_vm_instance_reference_v2.go index 929e93a8..57fd301f 100644 --- a/power/models/p_vm_instance_reference_v2.go +++ b/power/models/p_vm_instance_reference_v2.go @@ -77,6 +77,9 @@ type PVMInstanceReferenceV2 struct { // The pvm instance virtual CPU information VirtualCores *PVMInstanceVirtualCores `json:"virtualCores,omitempty"` + + // Information about Virtual Serial Number assigned to the PVM Instance + VirtualSerialNumber *GetServerVirtualSerialNumber `json:"virtualSerialNumber,omitempty"` } // Validate validates this p VM instance reference v2 @@ -147,6 +150,10 @@ func (m *PVMInstanceReferenceV2) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateVirtualSerialNumber(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -420,6 +427,25 @@ func (m *PVMInstanceReferenceV2) validateVirtualCores(formats strfmt.Registry) e return nil } +func (m *PVMInstanceReferenceV2) validateVirtualSerialNumber(formats strfmt.Registry) error { + if swag.IsZero(m.VirtualSerialNumber) { // not required + return nil + } + + if m.VirtualSerialNumber != nil { + if err := m.VirtualSerialNumber.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualSerialNumber") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualSerialNumber") + } + return err + } + } + + return nil +} + // ContextValidate validate this p VM instance reference v2 based on the context it is used func (m *PVMInstanceReferenceV2) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -468,6 +494,10 @@ func (m *PVMInstanceReferenceV2) ContextValidate(ctx context.Context, formats st res = append(res, err) } + if err := m.contextValidateVirtualSerialNumber(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -690,6 +720,27 @@ func (m *PVMInstanceReferenceV2) contextValidateVirtualCores(ctx context.Context return nil } +func (m *PVMInstanceReferenceV2) contextValidateVirtualSerialNumber(ctx context.Context, formats strfmt.Registry) error { + + if m.VirtualSerialNumber != nil { + + if swag.IsZero(m.VirtualSerialNumber) { // not required + return nil + } + + if err := m.VirtualSerialNumber.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualSerialNumber") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualSerialNumber") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PVMInstanceReferenceV2) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/p_vm_instance_volume_update.go b/power/models/p_vm_instance_volume_update.go index d3ab5a7c..c5d841f6 100644 --- a/power/models/p_vm_instance_volume_update.go +++ b/power/models/p_vm_instance_volume_update.go @@ -19,7 +19,7 @@ import ( // swagger:model PVMInstanceVolumeUpdate type PVMInstanceVolumeUpdate struct { - // Indicates if the volume should be deleted when the PVMInstance is terminated + // Indicates if the volume should be deleted when the PVMInstance is terminated. // Required: true DeleteOnTermination *bool `json:"deleteOnTermination"` } diff --git a/power/models/remove_virtual_serial_number.go b/power/models/remove_virtual_serial_number.go new file mode 100644 index 00000000..ac635119 --- /dev/null +++ b/power/models/remove_virtual_serial_number.go @@ -0,0 +1,71 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// RemoveVirtualSerialNumber remove virtual serial number +// +// swagger:model RemoveVirtualSerialNumber +type RemoveVirtualSerialNumber struct { + + // Provide a reserved Virtual Serial Number + // Required: true + Serial *string `json:"serial"` +} + +// Validate validates this remove virtual serial number +func (m *RemoveVirtualSerialNumber) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSerial(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RemoveVirtualSerialNumber) validateSerial(formats strfmt.Registry) error { + + if err := validate.Required("serial", "body", m.Serial); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this remove virtual serial number based on context it is used +func (m *RemoveVirtualSerialNumber) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *RemoveVirtualSerialNumber) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *RemoveVirtualSerialNumber) UnmarshalBinary(b []byte) error { + var res RemoveVirtualSerialNumber + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/update_server_virtual_serial_number.go b/power/models/update_server_virtual_serial_number.go new file mode 100644 index 00000000..921dcdd6 --- /dev/null +++ b/power/models/update_server_virtual_serial_number.go @@ -0,0 +1,71 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// UpdateServerVirtualSerialNumber update server virtual serial number +// +// swagger:model UpdateServerVirtualSerialNumber +type UpdateServerVirtualSerialNumber struct { + + // Description of the Virtual Serial Number + // Required: true + Description *string `json:"description"` +} + +// Validate validates this update server virtual serial number +func (m *UpdateServerVirtualSerialNumber) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UpdateServerVirtualSerialNumber) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this update server virtual serial number based on context it is used +func (m *UpdateServerVirtualSerialNumber) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *UpdateServerVirtualSerialNumber) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UpdateServerVirtualSerialNumber) UnmarshalBinary(b []byte) error { + var res UpdateServerVirtualSerialNumber + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/update_virtual_serial_number.go b/power/models/update_virtual_serial_number.go new file mode 100644 index 00000000..a2592c41 --- /dev/null +++ b/power/models/update_virtual_serial_number.go @@ -0,0 +1,71 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// UpdateVirtualSerialNumber update virtual serial number +// +// swagger:model UpdateVirtualSerialNumber +type UpdateVirtualSerialNumber struct { + + // Description of the Virtual Serial Number + // Required: true + Description *string `json:"description"` +} + +// Validate validates this update virtual serial number +func (m *UpdateVirtualSerialNumber) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UpdateVirtualSerialNumber) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this update virtual serial number based on context it is used +func (m *UpdateVirtualSerialNumber) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *UpdateVirtualSerialNumber) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UpdateVirtualSerialNumber) UnmarshalBinary(b []byte) error { + var res UpdateVirtualSerialNumber + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/virtual_serial_number.go b/power/models/virtual_serial_number.go new file mode 100644 index 00000000..96c211c5 --- /dev/null +++ b/power/models/virtual_serial_number.go @@ -0,0 +1,105 @@ +// 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" +) + +// VirtualSerialNumber virtual serial number +// +// swagger:model VirtualSerialNumber +type VirtualSerialNumber struct { + + // Description of the Virtual Serial Number + // Required: true + Description *string `json:"description"` + + // ID of the PVM Instance Virtual Serial Number is attached to. + // Required: true + PvmInstanceID *string `json:"pvmInstanceID"` + + // Virtual Serial Number assigned to the PVM Instance + // Required: true + Serial *string `json:"serial"` +} + +// Validate validates this virtual serial number +func (m *VirtualSerialNumber) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePvmInstanceID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSerial(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VirtualSerialNumber) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *VirtualSerialNumber) validatePvmInstanceID(formats strfmt.Registry) error { + + if err := validate.Required("pvmInstanceID", "body", m.PvmInstanceID); err != nil { + return err + } + + return nil +} + +func (m *VirtualSerialNumber) validateSerial(formats strfmt.Registry) error { + + if err := validate.Required("serial", "body", m.Serial); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this virtual serial number based on context it is used +func (m *VirtualSerialNumber) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *VirtualSerialNumber) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VirtualSerialNumber) UnmarshalBinary(b []byte) error { + var res VirtualSerialNumber + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/virtual_serial_number_list.go b/power/models/virtual_serial_number_list.go new file mode 100644 index 00000000..a83f8bda --- /dev/null +++ b/power/models/virtual_serial_number_list.go @@ -0,0 +1,78 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// VirtualSerialNumberList List of all Virtual Serial Numbers +// +// swagger:model VirtualSerialNumberList +type VirtualSerialNumberList []*VirtualSerialNumber + +// Validate validates this virtual serial number list +func (m VirtualSerialNumberList) Validate(formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + if swag.IsZero(m[i]) { // not required + continue + } + + if m[i] != nil { + if err := m[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this virtual serial number list based on the context it is used +func (m VirtualSerialNumberList) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + + if m[i] != nil { + + if swag.IsZero(m[i]) { // not required + return nil + } + + if err := m[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/models/volume.go b/power/models/volume.go index 5394c368..8a7fc54f 100644 --- a/power/models/volume.go +++ b/power/models/volume.go @@ -43,7 +43,7 @@ type Volume struct { // crn Crn CRN `json:"crn,omitempty"` - // Indicates if the volume should be deleted when the server terminates + // Indicates if the volume should be deleted when the server terminates. Only returned when querying a server's attached volumes DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` // Type of Disk diff --git a/power/models/volume_reference.go b/power/models/volume_reference.go index 037c3b43..dedbebfb 100644 --- a/power/models/volume_reference.go +++ b/power/models/volume_reference.go @@ -44,7 +44,7 @@ type VolumeReference struct { // crn Crn CRN `json:"crn,omitempty"` - // Indicates if the volume should be deleted when the server terminates + // Indicates if the volume should be deleted when the server terminates. Only returned when querying a server's attached volumes DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` // Type of Disk