From f2330728e3e99aea71d61b7041f0a98032e2664b Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Tue, 18 Jun 2024 13:42:55 -0500 Subject: [PATCH 001/123] Gate ibmi 500 (#414) * Bump github.com/IBM/platform-services-go-sdk from 0.56.4 to 0.57.0 Bumps [github.com/IBM/platform-services-go-sdk](https://github.com/IBM/platform-services-go-sdk) from 0.56.4 to 0.57.0. - [Release notes](https://github.com/IBM/platform-services-go-sdk/releases) - [Changelog](https://github.com/IBM/platform-services-go-sdk/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/platform-services-go-sdk/compare/v0.56.4...v0.57.0) --- updated-dependencies: - dependency-name: github.com/IBM/platform-services-go-sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump github.com/IBM/platform-services-go-sdk from 0.57.0 to 0.58.0 Bumps [github.com/IBM/platform-services-go-sdk](https://github.com/IBM/platform-services-go-sdk) from 0.57.0 to 0.58.0. - [Release notes](https://github.com/IBM/platform-services-go-sdk/releases) - [Changelog](https://github.com/IBM/platform-services-go-sdk/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/platform-services-go-sdk/compare/v0.57.0...v0.58.0) --- updated-dependencies: - dependency-name: github.com/IBM/platform-services-go-sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump github.com/IBM/platform-services-go-sdk from 0.58.0 to 0.59.0 Bumps [github.com/IBM/platform-services-go-sdk](https://github.com/IBM/platform-services-go-sdk) from 0.58.0 to 0.59.0. - [Release notes](https://github.com/IBM/platform-services-go-sdk/releases) - [Changelog](https://github.com/IBM/platform-services-go-sdk/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/platform-services-go-sdk/compare/v0.58.0...v0.59.0) --- updated-dependencies: - dependency-name: github.com/IBM/platform-services-go-sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump github.com/IBM/platform-services-go-sdk from 0.59.0 to 0.59.1 Bumps [github.com/IBM/platform-services-go-sdk](https://github.com/IBM/platform-services-go-sdk) from 0.59.0 to 0.59.1. - [Release notes](https://github.com/IBM/platform-services-go-sdk/releases) - [Changelog](https://github.com/IBM/platform-services-go-sdk/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/platform-services-go-sdk/compare/v0.59.0...v0.59.1) --- updated-dependencies: - dependency-name: github.com/IBM/platform-services-go-sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.4 to 1.9.0. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](https://github.com/stretchr/testify/compare/v1.8.4...v1.9.0) --- updated-dependencies: - dependency-name: github.com/stretchr/testify dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump github.com/IBM/platform-services-go-sdk from 0.59.1 to 0.60.0 Bumps [github.com/IBM/platform-services-go-sdk](https://github.com/IBM/platform-services-go-sdk) from 0.59.1 to 0.60.0. - [Release notes](https://github.com/IBM/platform-services-go-sdk/releases) - [Changelog](https://github.com/IBM/platform-services-go-sdk/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/platform-services-go-sdk/compare/v0.59.1...v0.60.0) --- updated-dependencies: - dependency-name: github.com/IBM/platform-services-go-sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Update to go 1.22 * Gate ibmi 500 update go sum --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- clients/instance/ibm-pi-volume.go | 26 ++------------------------ go.sum | 4 ++-- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/clients/instance/ibm-pi-volume.go b/clients/instance/ibm-pi-volume.go index a05849c3..e5a628ba 100644 --- a/clients/instance/ibm-pi-volume.go +++ b/clients/instance/ibm-pi-volume.go @@ -257,34 +257,12 @@ func (f *IBMPIVolumeClient) GetVolumeFlashCopyMappings(id string) (models.FlashC // Bulk volume detach func (f *IBMPIVolumeClient) BulkVolumeDetach(pvmID string, body *models.VolumesDetach) (*models.VolumesDetachmentResponse, error) { - params := p_cloud_volumes.NewPcloudV2PvminstancesVolumesDeleteParams(). - WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut).WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(pvmID). - WithBody(body) - resp, err := f.session.Power.PCloudVolumes.PcloudV2PvminstancesVolumesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) - if err != nil { - return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf(errors.DetachVolumesOperationFailed, pvmID, f.cloudInstanceID, err)) - } - if resp == nil || resp.Payload == nil { - return nil, fmt.Errorf("failed detaching volumes for %s", pvmID) - } - return resp.Payload, nil + return nil, fmt.Errorf("operation not supported") } // Bulk volume delete func (f *IBMPIVolumeClient) BulkVolumeDelete(body *models.VolumesDelete) (*models.VolumesDeleteResponse, error) { - params := p_cloud_volumes.NewPcloudV2VolumesDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). - WithCloudInstanceID(f.cloudInstanceID).WithBody(body) - respOk, respPartial, err := f.session.Power.PCloudVolumes.PcloudV2VolumesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) - if err != nil { - return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf(errors.DeleteVolumeOperationFailed, body.VolumeIDs, err)) - } - if respOk != nil && respOk.Payload != nil { - return respOk.Payload, nil - } - if respPartial != nil && respPartial.Payload != nil { - return respPartial.Payload, nil - } - return nil, fmt.Errorf("failed Deleting volumes : %s", body.VolumeIDs) + return nil, fmt.Errorf("operation not supported") } // Bulk volutme attach diff --git a/go.sum b/go.sum index 86e4bfb8..0ae0fcce 100644 --- a/go.sum +++ b/go.sum @@ -78,8 +78,8 @@ github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/gomega v1.31.1 h1:KYppCUK+bUgAZwHOu7EXVBKyQA6ILvOESHkn/tgoqvo= -github.com/onsi/gomega v1.31.1/go.mod h1:y40C95dwAD1Nz36SsEnxvfFe8FFfNxzI5eJ0EYGyAy0= +github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg= +github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= From e90e3aea654a30cf7f3759ad49104ae44669c4e7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jun 2024 22:14:09 +0000 Subject: [PATCH 002/123] Bump github.com/hashicorp/go-retryablehttp from 0.7.5 to 0.7.7 Bumps [github.com/hashicorp/go-retryablehttp](https://github.com/hashicorp/go-retryablehttp) from 0.7.5 to 0.7.7. - [Changelog](https://github.com/hashicorp/go-retryablehttp/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashicorp/go-retryablehttp/compare/v0.7.5...v0.7.7) --- updated-dependencies: - dependency-name: github.com/hashicorp/go-retryablehttp dependency-type: indirect ... Signed-off-by: dependabot[bot] --- go.mod | 4 ++-- go.sum | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 49b13a69..7510268e 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-retryablehttp v0.7.5 // indirect + github.com/hashicorp/go-retryablehttp v0.7.7 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/leodido/go-urn v1.3.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect @@ -45,7 +45,7 @@ require ( go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/crypto v0.21.0 // indirect golang.org/x/net v0.23.0 // indirect - golang.org/x/sys v0.18.0 // indirect + golang.org/x/sys v0.20.0 // indirect golang.org/x/text v0.14.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 0ae0fcce..f5ddf185 100644 --- a/go.sum +++ b/go.sum @@ -9,6 +9,8 @@ github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:W github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= @@ -54,10 +56,10 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= -github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M= -github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU= +github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= @@ -69,6 +71,10 @@ github.com/leodido/go-urn v1.3.0 h1:jX8FDLfW4ThVXctBNZ+3cIWnCSnrACDV73r76dy0aQQ= github.com/leodido/go-urn v1.3.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= @@ -87,7 +93,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= @@ -124,8 +129,8 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= From a9c7e1b18324bb606b1f74f0af123448d2789f3a Mon Sep 17 00:00:00 2001 From: Kishen V Date: Tue, 20 Aug 2024 21:11:45 +0530 Subject: [PATCH 003/123] Get the supported storage tiers of a cloud instance (#446) Signed-off-by: Kishen V --- clients/instance/ibm-pi-storage-tiers.go | 40 ++++++++++++++++++++++++ errors/errors.go | 7 +++-- 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 clients/instance/ibm-pi-storage-tiers.go diff --git a/clients/instance/ibm-pi-storage-tiers.go b/clients/instance/ibm-pi-storage-tiers.go new file mode 100644 index 00000000..fbb87629 --- /dev/null +++ b/clients/instance/ibm-pi-storage-tiers.go @@ -0,0 +1,40 @@ +package instance + +import ( + "context" + "fmt" + + "github.com/IBM-Cloud/power-go-client/errors" + "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_storage_tiers" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPIStorageTierClient +type IBMPIStorageTierClient struct { + IBMPIClient +} + +// NewIBMPIStorageTierClient +func NewIBMPIStorageTierClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPIStorageTierClient { + return &IBMPIStorageTierClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// Gets all the storage tiers associated to the cloud instance. +func (f *IBMPIStorageTierClient) GetAll() (models.RegionStorageTiers, error) { + params := p_cloud_storage_tiers.NewPcloudCloudinstancesStoragetiersGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID) + resp, err := f.session.Power.PCloudStorageTiers.PcloudCloudinstancesStoragetiersGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf(errors.GetAllStorageTiersOperationFailed, f.cloudInstanceID, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get all storage tiers") + } + return resp.Payload, nil +} diff --git a/errors/errors.go b/errors/errors.go index 3e58eb5b..6c9fcbfe 100644 --- a/errors/errors.go +++ b/errors/errors.go @@ -121,12 +121,15 @@ const DeleteSPPPlacementGroupOperationFailed = "failed to perform Delete Shared const AddMemberSPPPlacementGroupOperationFailed = "failed to perform Add Member Operation for pool %s and shared processor pool placement group %s with error %w" const DeleteMemberSPPPlacementGroupOperationFailed = "failed to perform Delete Member Operation for pool %s and shared processor pool placement group %s with error %w" -// start of workspaces +// start of Workspaces Messages const GetWorkspaceOperationFailed = "failed to perform Get Workspace Operation for id %s with error %w" -// Datacenter +// start of Datacenter Messages const GetDatacenterOperationFailed = "failed to perform Get Datacenter Operation for id %s with error %w" +// start of StorageTier Messages +const GetAllStorageTiersOperationFailed = "failed to perform get all Storage Tiers Operation for id %s with error %w" + // ErrorTarget ... type ErrorTarget struct { Name string From bd839aacdf475da9ec5d4e9f5961a6443b7b7710 Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Mon, 26 Aug 2024 08:53:21 -0500 Subject: [PATCH 004/123] Fix go.mod version (#419) --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 7510268e..5c3ed7b1 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/IBM-Cloud/power-go-client -go 1.22 +go 1.22.0 require ( github.com/IBM/go-sdk-core/v5 v5.15.3 From 4bae719b382351993e79df289c796fb31f75279a Mon Sep 17 00:00:00 2001 From: ismirlia <90468712+ismirlia@users.noreply.github.com> Date: Wed, 11 Sep 2024 15:13:55 -0500 Subject: [PATCH 005/123] Q3 Release 2024 (#459) * Add hostgroups (#326) * Add hostgroups * Fix build * Update swagger client and models to service-broker v1.140.0 (#337) * Generated Swagger client from service-broker commit f482db37dd0b38392de1f3aecdc2219212147830 * Fix build --------- Co-authored-by: michael kad * Update swagger client and models to service-broker v1.140.0 (#336) * Generated Swagger client from service-broker commit 9786c4b2360ad846a1aa8f68f01fbb41979af3c9 * Fix build --------- Co-authored-by: michael kad * Update swagger client and models to service-broker v1.140.0 (#346) * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh * Update golangci-lint version and skip cache Signed-off-by: Yussuf Shaikh * Add branch to dependabot (#338) * Add branch to dependabot * Fix build * Generated Swagger client from service-broker commit 1db48bf5f665abf4e91c66d019aa231b913db3d9 --------- Signed-off-by: dependabot[bot] Signed-off-by: Yussuf Shaikh Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Yussuf Shaikh Co-authored-by: michaelkad <45772690+michaelkad@users.noreply.github.com> * Update swagger client and models to service-broker v1.140.0 (#347) * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh * Update golangci-lint version and skip cache Signed-off-by: Yussuf Shaikh * Add branch to dependabot (#338) * Add branch to dependabot * Fix build * Generated Swagger client from service-broker commit b0bfdfb575c650fd620a92f064c1f7b05d1dd56d --------- Signed-off-by: dependabot[bot] Signed-off-by: Yussuf Shaikh Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Yussuf Shaikh Co-authored-by: michaelkad <45772690+michaelkad@users.noreply.github.com> * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh * Add branch to dependabot (#338) * Add branch to dependabot * Fix build * Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.4 to 1.9.0. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](https://github.com/stretchr/testify/compare/v1.8.4...v1.9.0) --- updated-dependencies: - dependency-name: github.com/stretchr/testify dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump github.com/IBM/platform-services-go-sdk from 0.59.1 to 0.60.0 Bumps [github.com/IBM/platform-services-go-sdk](https://github.com/IBM/platform-services-go-sdk) from 0.59.1 to 0.60.0. - [Release notes](https://github.com/IBM/platform-services-go-sdk/releases) - [Changelog](https://github.com/IBM/platform-services-go-sdk/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/platform-services-go-sdk/compare/v0.59.1...v0.60.0) --- updated-dependencies: - dependency-name: github.com/IBM/platform-services-go-sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Add Removal of Create VPN (#315) Adding back vpn create removal * Revert "Enable shared-processor-pool functionality on stratos" (#354) This reverts commit d32d15616555c890d73c99bbfcb564d1ef2b0ad9. * Remove duplicate go setup step (#348) * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh * Add branch to dependabot (#338) * Add branch to dependabot * Fix build * Remove duplicate go setup step (#348) * Update swagger client and models to service-broker v1.140.0 (#337) * Generated Swagger client from service-broker commit f482db37dd0b38392de1f3aecdc2219212147830 * Fix build --------- Co-authored-by: michael kad * Update swagger client and models to service-broker v1.140.0 (#346) * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh * Update golangci-lint version and skip cache Signed-off-by: Yussuf Shaikh * Add branch to dependabot (#338) * Add branch to dependabot * Fix build * Generated Swagger client from service-broker commit 1db48bf5f665abf4e91c66d019aa231b913db3d9 --------- Signed-off-by: dependabot[bot] Signed-off-by: Yussuf Shaikh Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Yussuf Shaikh Co-authored-by: michaelkad <45772690+michaelkad@users.noreply.github.com> * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Add branch to dependabot (#338) * Add branch to dependabot * Fix build * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Add hostgroups (#326) * Add hostgroups * Fix build * Update swagger client and models to service-broker v1.140.0 (#337) * Generated Swagger client from service-broker commit f482db37dd0b38392de1f3aecdc2219212147830 * Fix build --------- Co-authored-by: michael kad * Update swagger client and models to service-broker v1.140.0 (#346) * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh * Update golangci-lint version and skip cache Signed-off-by: Yussuf Shaikh * Add branch to dependabot (#338) * Add branch to dependabot * Fix build * Generated Swagger client from service-broker commit 1db48bf5f665abf4e91c66d019aa231b913db3d9 --------- Signed-off-by: dependabot[bot] Signed-off-by: Yussuf Shaikh Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Yussuf Shaikh Co-authored-by: michaelkad <45772690+michaelkad@users.noreply.github.com> * Update swagger client and models to service-broker v1.140.0 (#347) * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh * Update golangci-lint version and skip cache Signed-off-by: Yussuf Shaikh * Add branch to dependabot (#338) * Add branch to dependabot * Fix build * Generated Swagger client from service-broker commit b0bfdfb575c650fd620a92f064c1f7b05d1dd56d --------- Signed-off-by: dependabot[bot] Signed-off-by: Yussuf Shaikh Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Yussuf Shaikh Co-authored-by: michaelkad <45772690+michaelkad@users.noreply.github.com> * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh * Add branch to dependabot (#338) * Add branch to dependabot * Fix build * Remove duplicate go setup step (#348) * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh * Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh * Add branch to dependabot (#338) * Add branch to dependabot * Fix build * Update swagger client and models to service-broker v1.140.0 (#337) * Generated Swagger client from service-broker commit f482db37dd0b38392de1f3aecdc2219212147830 * Fix build --------- Co-authored-by: michael kad * Update swagger client and models to service-broker v1.140.0 (#346) * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh * Update golangci-lint version and skip cache Signed-off-by: Yussuf Shaikh * Add branch to dependabot (#338) * Add branch to dependabot * Fix build * Generated Swagger client from service-broker commit 1db48bf5f665abf4e91c66d019aa231b913db3d9 --------- Signed-off-by: dependabot[bot] Signed-off-by: Yussuf Shaikh Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Yussuf Shaikh Co-authored-by: michaelkad <45772690+michaelkad@users.noreply.github.com> * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Add branch to dependabot (#338) * Add branch to dependabot * Fix build * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Generated Swagger client from service-broker commit 0fecb85e68db0dcc5ddf2eb1072b39d45e2fef86 (#356) * Generated Swagger client from service-broker commit a74a353d92fbe6cfeb2421df47b52c5cc0e9d689 * Generated Swagger client from service-broker commit e98a290ebdfbe53e5fec9ff5100a299bc77a6014 * Generated Swagger client from service-broker commit a9e6e612e2556e1c67678aebe155d22089a75639 * Generated Swagger client from service-broker commit 70b0722398f5a64ea1e7bf1fbd07c6b3e7f8c9fc (#360) * Generated Swagger client from service-broker commit 8ea7617cec1e857b8597b60c4db288df066295f8 (#363) * Generated Swagger client from service-broker commit 384961399c43e0ea945615662e92396491168189 (#362) * Update Hostgroup client and add stratos validation (#361) * Update Hostgroup client and add stratos validation * Update name to hostGroup pattern * Rename file * Generated Swagger client from service-broker commit 125c585619c1c406c466dfae897cc2bff5faf797 (#364) * Generated Swagger client from service-broker commit 6238c39937d5f7a63f07fba4fd83d5d18e18752b (#365) * Refactor host group name (#367) * Generated Swagger client from service-broker commit 4c221d25789a0cbf90427cfb5e22509532cf4265 (#366) * Generated Swagger client from service-broker commit 1efc6f47450f757d13cf5813a45212ed381b2b8d (#368) * Generated Swagger client from service-broker commit f627067b7cfb1a503a8fe46e15715957137676f5 (#370) * Generated Swagger client from service-broker commit e43ad9dd41dd11d0210c10b8ffa0104e1b74afd0 (#371) * [IBMPIHostGroupsClient]Fix typo (#369) * Refactor host group name * Fix typo * sync branch * Add checksum gates for powervs (#372) * Generated Swagger client from service-broker commit 0562d1c6f66295c4ee5c4df5179dd6b2b41c0097 (#373) * Generated Swagger client from service-broker commit c4cb98d889ffe37cd2324735bfc86efe4e1fdbb6 (#374) * Generated Swagger client from service-broker commit 8f5f60718bab6db63d05bacb4fb30550762b50eb (#375) * Generated Swagger client from service-broker commit b9bc7ab551a37f4cd3546c19757fe74b6eee179f (#380) * Fix error in host-group example (#376) There appeared to be a typo in the client definition preventing the example from compiling. * Add deploymentTarget safeguard for Stratos (#378) * Add deploymentTarget safeguard This option is only available off-prem where dedicated host commands are supported. * Remove IBMi safeguard for stratos * Update instance create safeguard * Update spp safeguards for stratos (#379) * Update spp safeguards for stratos SPP commands will be supported for Q2 for stratos, but not the dedicated host-id option. * Update host-id error message * Generated Swagger client from service-broker commit 2a7c3111d7d5c55678486f3cab44f3437796762c (#381) WorkspacePowerEdgeRouterDetails state addition * Bump golang.org/x/net from 0.20.0 to 0.23.0 (#384) Bumps [golang.org/x/net](https://github.com/golang/net) from 0.20.0 to 0.23.0. - [Commits](https://github.com/golang/net/compare/v0.20.0...v0.23.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Generated Swagger client from service-broker commit a76fd7fb2c0026fa0c68c2a52417f395f801dd46 (#386) * Generated Swagger client from service-broker commit bfe8b85d361707cf82c025266813ecb7889a556c (#388) * Bump golangci/golangci-lint-action from 4 to 5 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 4 to 5. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/v4...v5) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] (cherry picked from commit 2c275e78e830dc1584c26ee62271b3be8e71a3ee) * Bump golangci/golangci-lint-action from 4 to 5 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 4 to 5. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/v4...v5) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] (cherry picked from commit 2c275e78e830dc1584c26ee62271b3be8e71a3ee) * Generated Swagger client from service-broker commit a433c612326d695146ca7953d6aef37ac709618f (#389) * Generated Swagger client from service-broker commit 6f9b593c228169c62a3b446bfc480cab28b91ed2 (#390) * Generated Swagger client from service-broker commit a08ee4720fe9268263f8c3bee59330454b619109 (#392) * Generated Swagger client from service-broker commit bd9c5c4d29bd093067dd82a8dce8e5b746a0284b (#394) * Generated Swagger client from service-broker commit 1a54ea3efa13779bf08f2c162677acdd026001c9 (#399) * Update to go 1.22 (#396) * Generated Swagger client from service-broker commit f43b28fb6f66ffdf7aa6499f4dc09619d22feeda (#401) * Generated Swagger client from service-broker commit 814f6cac25d7b8aef6e71aa89b6ba9ebecbfff9e (#402) * Generated Swagger client from service-broker commit d82c42a9b20ab1dcd2188c89e0b0a3c8ea8db1ff (#403) * Generated Swagger client from service-broker commit ad5b24d0dca3b490cb45eadc0284d9bbcfbcea4e (#404) * Generated Swagger client from service-broker commit 5fa65c3c11cd0c1479d3c3e135aa62c79cfd84bf (#405) * Generated Swagger client from service-broker commit c455f6094ce91e25678e3fe9575767c3122cf837 (#406) * Generated Swagger client from service-broker commit f19df27ca2e676ba6cb9f5e73036f4536d5c050c (#407) * Generated Swagger client from service-broker commit f856adaa7760209889781f329a122db016cc5587 (#408) * Generated Swagger client from service-broker commit b7a20105660b86a198fa90be0e47093ac3ff9a5d (#409) * Generated Swagger client from service-broker commit a12c633b384121ad968e29dc314911c618f594fb (#411) * Generated Swagger client from service-broker commit e5f06d783dd7b97fec439b1aab6b685acf4faaaf (#415) * Generated Swagger client from service-broker commit f6e02b8a86dff9db756936ce068fe9c691b65bf0 (#417) * Generated Swagger client from service-broker commit fd290cea4c8f21c4cdbcf02ab10d3d0b895d310e (#424) * Add Snaphots (#420) * Generated Swagger client from service-broker commit 35aa4910370044d82d24dad103292b5963600875 (#427) * Generated Swagger client from service-broker commit 01eebb83bef64e16e87162c9c7654c8a166e5086 (#431) * Generated Swagger client from service-broker commit 94340a77d5b13ff1055439c17c7a0202e88b1590 (#433) * Block gateway network update for stratos (#429) * Generated Swagger client from service-broker commit f82abb1277ab5b723c24869c6428d76919342fed (#438) * Add Network Address Group (#435) * Network Security Group (#434) * Network Security Group * Add nsg action * Add Network Interface (#437) * Add Network Interface * Update clients/instance/ibm-pi-network.go Co-authored-by: ismirlia <90468712+ismirlia@users.noreply.github.com> * Update clients/instance/ibm-pi-network.go Co-authored-by: ismirlia <90468712+ismirlia@users.noreply.github.com> * Update clients/instance/ibm-pi-network.go Co-authored-by: ismirlia <90468712+ismirlia@users.noreply.github.com> --------- Co-authored-by: ismirlia <90468712+ismirlia@users.noreply.github.com> * Generated Swagger client from service-broker commit 8ef4989190f08ba3544a8958ccbb5aeb3cab15dd (#439) * Fix typo in file name (#442) * Generated Swagger client from service-broker commit dcdebb6b0053044d882d02b44116455004075bf5 (#440) * Revert "Block gateway network update for stratos (#429)" (#441) This reverts commit 4710183925ba7616f1e058ba5af764ccab03da0d. * Generated Swagger client from service-broker commit 20f660a90900d9ca627b9178a00f5ebf1fdc0e51 (#443) * Update NSG[rm direction], NI[ch PvmInstance ->Instance, rm NetworkSecurityGroupID](#445) * V1VolumeSnapshots SB commit 993d71eee3199d4805cab774d50d7edad91f067c (#447) * Add Volume Snapshot/s V1 (#448) * Update [M]NAg,NSG: member, rules; SysPool: CoreIncrement SB commit c78e75aa6d199faa5196e1bac0488071a074b8c9 (#451) * Update [M] Volumes: bootvolume description SB commit 12b759fc126a30ce8537daef3f9bf56e2f3ddbaf (#453) * Update NSG and NAG types (#452) * Change NSG and NAG response types * Fix deletes * [M] NetworkSecurityGroupRuleProtocol: IcmpTypes float64-> int64 SB commit 8052ef5f496669f885519678a3e9fe6fe638cf5d (#454) * [M] NetworkSecurityGroupRulePort: min and max limit, NSG Rule: rm Direction and Name SB commit 4a6fb79d2076748aedcfcfa65b727fc413e8a7df (#455) * Update [M] NAG, NSG: UserTags add omitempty SB commit 6b88f9d59f3ce12ee6b320cfa7b7727243bc661a (#456) Update [M] NAG, NSG: UserTags add omitempty * Fix NAG Update (#457) * Fix NAG Member Create (#458) * Gate ibmi 500 (#414) * Bump github.com/IBM/platform-services-go-sdk from 0.56.4 to 0.57.0 Bumps [github.com/IBM/platform-services-go-sdk](https://github.com/IBM/platform-services-go-sdk) from 0.56.4 to 0.57.0. - [Release notes](https://github.com/IBM/platform-services-go-sdk/releases) - [Changelog](https://github.com/IBM/platform-services-go-sdk/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/platform-services-go-sdk/compare/v0.56.4...v0.57.0) --- updated-dependencies: - dependency-name: github.com/IBM/platform-services-go-sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump github.com/IBM/platform-services-go-sdk from 0.57.0 to 0.58.0 Bumps [github.com/IBM/platform-services-go-sdk](https://github.com/IBM/platform-services-go-sdk) from 0.57.0 to 0.58.0. - [Release notes](https://github.com/IBM/platform-services-go-sdk/releases) - [Changelog](https://github.com/IBM/platform-services-go-sdk/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/platform-services-go-sdk/compare/v0.57.0...v0.58.0) --- updated-dependencies: - dependency-name: github.com/IBM/platform-services-go-sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump github.com/IBM/platform-services-go-sdk from 0.58.0 to 0.59.0 Bumps [github.com/IBM/platform-services-go-sdk](https://github.com/IBM/platform-services-go-sdk) from 0.58.0 to 0.59.0. - [Release notes](https://github.com/IBM/platform-services-go-sdk/releases) - [Changelog](https://github.com/IBM/platform-services-go-sdk/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/platform-services-go-sdk/compare/v0.58.0...v0.59.0) --- updated-dependencies: - dependency-name: github.com/IBM/platform-services-go-sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump github.com/IBM/platform-services-go-sdk from 0.59.0 to 0.59.1 Bumps [github.com/IBM/platform-services-go-sdk](https://github.com/IBM/platform-services-go-sdk) from 0.59.0 to 0.59.1. - [Release notes](https://github.com/IBM/platform-services-go-sdk/releases) - [Changelog](https://github.com/IBM/platform-services-go-sdk/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/platform-services-go-sdk/compare/v0.59.0...v0.59.1) --- updated-dependencies: - dependency-name: github.com/IBM/platform-services-go-sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.4 to 1.9.0. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](https://github.com/stretchr/testify/compare/v1.8.4...v1.9.0) --- updated-dependencies: - dependency-name: github.com/stretchr/testify dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump github.com/IBM/platform-services-go-sdk from 0.59.1 to 0.60.0 Bumps [github.com/IBM/platform-services-go-sdk](https://github.com/IBM/platform-services-go-sdk) from 0.59.1 to 0.60.0. - [Release notes](https://github.com/IBM/platform-services-go-sdk/releases) - [Changelog](https://github.com/IBM/platform-services-go-sdk/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/platform-services-go-sdk/compare/v0.59.1...v0.60.0) --- updated-dependencies: - dependency-name: github.com/IBM/platform-services-go-sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Update to go 1.22 * Gate ibmi 500 update go sum --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Remove Q4 features from SDK * Enable bulk-detach and bulk-delete for Q3 --------- Signed-off-by: dependabot[bot] Signed-off-by: Yussuf Shaikh Co-authored-by: michaelkad <45772690+michaelkad@users.noreply.github.com> Co-authored-by: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Co-authored-by: michael kad Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Yussuf Shaikh Co-authored-by: powervs-ibm Co-authored-by: Alexander-Kita --- clients/instance/ibm-pi-snapshot.go | 58 ++ examples/snapshot/main.go | 13 + .../pcloud_cloudconnections_post_responses.go | 76 +++ ...cloud_pvminstances_clone_post_responses.go | 76 +++ .../p_cloud_volumes/p_cloud_volumes_client.go | 41 ++ .../pcloud_v2_volumes_getall_parameters.go | 175 ++++++ .../pcloud_v2_volumes_getall_responses.go | 486 +++++++++++++++ power/client/snapshots/snapshots_client.go | 102 +++- .../v1_volume_snapshots_get_parameters.go | 151 +++++ .../v1_volume_snapshots_get_responses.go | 562 ++++++++++++++++++ .../v1_volume_snapshots_getall_parameters.go | 128 ++++ .../v1_volume_snapshots_getall_responses.go | 486 +++++++++++++++ power/models/add_host.go | 49 +- power/models/c_r_n.go | 27 + power/models/capabilities_details.go | 157 +++++ power/models/create_cos_image_import_job.go | 42 ++ power/models/create_data_volume.go | 53 +- power/models/create_image.go | 42 ++ power/models/datacenter.go | 51 ++ power/models/datacenter_location.go | 17 + power/models/disaster_recovery.go | 159 +++++ power/models/get_bulk_volume.go | 71 +++ power/models/host.go | 88 +++ power/models/image.go | 88 +++ power/models/image_reference.go | 46 ++ power/models/image_specifications.go | 3 + power/models/multi_volumes_create.go | 53 +- power/models/network.go | 88 +++ power/models/network_create.go | 42 ++ power/models/network_port.go | 2 +- power/models/network_port_create.go | 55 +- power/models/network_reference.go | 46 ++ power/models/p_vm_instance.go | 88 +++ power/models/p_vm_instance_capture.go | 49 +- power/models/p_vm_instance_create.go | 48 ++ power/models/p_vm_instance_reference.go | 46 ++ power/models/p_vm_instance_reference_v2.go | 46 ++ power/models/p_vm_instance_update_response.go | 2 +- power/models/replication_service.go | 141 +++++ power/models/replication_target_location.go | 108 ++++ power/models/s_a_p_create.go | 48 ++ power/models/shared_processor_pool.go | 88 +++ power/models/shared_processor_pool_create.go | 49 +- power/models/snapshot.go | 53 +- power/models/snapshot_create.go | 49 +- power/models/snapshot_create_response.go | 95 ++- power/models/snapshot_list.go | 2 +- power/models/snapshot_v1.go | 65 +- power/models/supported_systems.go | 88 +++ power/models/system_pool.go | 3 + power/models/tags.go | 27 + power/models/volume.go | 121 +++- power/models/volume_group.go | 9 + power/models/volume_group_details.go | 9 + power/models/volume_info.go | 59 +- power/models/volume_reference.go | 121 +++- power/models/volume_snapshot_list.go | 121 ++++ power/models/volumes_clone_async_request.go | 49 +- power/models/volumes_clone_execute.go | 49 +- 59 files changed, 5130 insertions(+), 36 deletions(-) create mode 100644 power/client/p_cloud_volumes/pcloud_v2_volumes_getall_parameters.go create mode 100644 power/client/p_cloud_volumes/pcloud_v2_volumes_getall_responses.go create mode 100644 power/client/snapshots/v1_volume_snapshots_get_parameters.go create mode 100644 power/client/snapshots/v1_volume_snapshots_get_responses.go create mode 100644 power/client/snapshots/v1_volume_snapshots_getall_parameters.go create mode 100644 power/client/snapshots/v1_volume_snapshots_getall_responses.go create mode 100644 power/models/c_r_n.go create mode 100644 power/models/capabilities_details.go create mode 100644 power/models/disaster_recovery.go create mode 100644 power/models/get_bulk_volume.go create mode 100644 power/models/replication_service.go create mode 100644 power/models/replication_target_location.go create mode 100644 power/models/supported_systems.go create mode 100644 power/models/tags.go create mode 100644 power/models/volume_snapshot_list.go diff --git a/clients/instance/ibm-pi-snapshot.go b/clients/instance/ibm-pi-snapshot.go index 676c9647..f1560d91 100644 --- a/clients/instance/ibm-pi-snapshot.go +++ b/clients/instance/ibm-pi-snapshot.go @@ -8,6 +8,8 @@ import ( "github.com/IBM-Cloud/power-go-client/ibmpisession" "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances" "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots" + "github.com/IBM-Cloud/power-go-client/power/client/snapshots" + "github.com/IBM-Cloud/power-go-client/power/models" ) @@ -96,3 +98,59 @@ func (f *IBMPISnapshotClient) Create(instanceID, snapshotID, restoreFailAction s } return resp.Payload, nil } + +// Get a Volume SnapshotV1 +func (f *IBMPISnapshotClient) V1VolumeSnapshotsGet(id string) (*models.SnapshotV1, error) { + params := snapshots.NewV1VolumeSnapshotsGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithVolumeSnapshotUUID(id) + resp, err := f.session.Power.Snapshots.V1VolumeSnapshotsGet(params, f.session.AuthInfo(f.cloudInstanceID)) + + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get volume snapshot %s: %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get PI Snapshot %s", id) + } + return resp.Payload, nil +} + +// Get Volume All SnapshotsV1 +func (f *IBMPISnapshotClient) V1VolumeSnapshotsGetall() (*models.VolumeSnapshotList, error) { + params := snapshots.NewV1VolumeSnapshotsGetallParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut) + resp, err := f.session.Power.Snapshots.V1VolumeSnapshotsGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get all volume snapshots: %w", err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get all volume Snapshots") + } + return resp.Payload, nil +} + +// Deprecated Get a SnapshotV1 +func (f *IBMPISnapshotClient) V1SnapshotsGet(id string) (*models.SnapshotV1, error) { + params := snapshots.NewV1SnapshotsGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithSnapshotID(id) + resp, err := f.session.Power.Snapshots.V1SnapshotsGet(params, f.session.AuthInfo(f.cloudInstanceID)) + + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get PI Snapshot %s: %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get PI Snapshot %s", id) + } + return resp.Payload, nil +} + +// Deprecated Get All SnapshotsV1 +func (f *IBMPISnapshotClient) V1SnapshotsGetall() (*models.SnapshotList, error) { + params := snapshots.NewV1SnapshotsGetallParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut) + resp, err := f.session.Power.Snapshots.V1SnapshotsGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get all PI Snapshots: %w", err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get all PI Snapshots") + } + return resp.Payload, nil +} diff --git a/examples/snapshot/main.go b/examples/snapshot/main.go index db5ead3d..55403a16 100644 --- a/examples/snapshot/main.go +++ b/examples/snapshot/main.go @@ -24,6 +24,7 @@ func main() { instance_id := " < INSTANCE ID > " snap_name := " < SNAPSHOT NAME > " description := " < DESCRIPTION > " + snapshot_id := " < SNAPSHOT ID > " authenticator := &core.BearerTokenAuthenticator{ BearerToken: token, @@ -81,4 +82,16 @@ func main() { } log.Printf("***************[4]****************** %+v \n", err) + // ***************[] SnapshotsV1 []****************** + getAllSnapV1Resp, err := powerSnapClient.V1SnapshotsGetall() + if err != nil { + log.Fatal(err) + } + log.Printf("***************[5]****************** %+v \n", getAllSnapV1Resp) + + getSnapV1Resp, err := powerSnapClient.V1SnapshotsGet(snapshot_id) + if err != nil { + log.Fatal(err) + } + log.Printf("***************[6]****************** %+v \n", getSnapV1Resp) } diff --git a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_responses.go b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_responses.go index 485b02fb..edd642b6 100644 --- a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_responses.go +++ b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_responses.go @@ -66,6 +66,12 @@ func (o *PcloudCloudconnectionsPostReader) ReadResponse(response runtime.ClientR return nil, err } return nil, result + case 405: + result := NewPcloudCloudconnectionsPostMethodNotAllowed() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result case 408: result := NewPcloudCloudconnectionsPostRequestTimeout() if err := result.readResponse(response, consumer, o.formats); err != nil { @@ -597,6 +603,76 @@ func (o *PcloudCloudconnectionsPostNotFound) readResponse(response runtime.Clien return nil } +// NewPcloudCloudconnectionsPostMethodNotAllowed creates a PcloudCloudconnectionsPostMethodNotAllowed with default headers values +func NewPcloudCloudconnectionsPostMethodNotAllowed() *PcloudCloudconnectionsPostMethodNotAllowed { + return &PcloudCloudconnectionsPostMethodNotAllowed{} +} + +/* +PcloudCloudconnectionsPostMethodNotAllowed describes a response with status code 405, with default header values. + +Method Not Allowed +*/ +type PcloudCloudconnectionsPostMethodNotAllowed struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud cloudconnections post method not allowed response has a 2xx status code +func (o *PcloudCloudconnectionsPostMethodNotAllowed) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud cloudconnections post method not allowed response has a 3xx status code +func (o *PcloudCloudconnectionsPostMethodNotAllowed) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud cloudconnections post method not allowed response has a 4xx status code +func (o *PcloudCloudconnectionsPostMethodNotAllowed) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud cloudconnections post method not allowed response has a 5xx status code +func (o *PcloudCloudconnectionsPostMethodNotAllowed) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud cloudconnections post method not allowed response a status code equal to that given +func (o *PcloudCloudconnectionsPostMethodNotAllowed) IsCode(code int) bool { + return code == 405 +} + +// Code gets the status code for the pcloud cloudconnections post method not allowed response +func (o *PcloudCloudconnectionsPostMethodNotAllowed) Code() int { + return 405 +} + +func (o *PcloudCloudconnectionsPostMethodNotAllowed) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsPostMethodNotAllowed %s", 405, payload) +} + +func (o *PcloudCloudconnectionsPostMethodNotAllowed) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsPostMethodNotAllowed %s", 405, payload) +} + +func (o *PcloudCloudconnectionsPostMethodNotAllowed) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsPostMethodNotAllowed) 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 +} + // NewPcloudCloudconnectionsPostRequestTimeout creates a PcloudCloudconnectionsPostRequestTimeout with default headers values func NewPcloudCloudconnectionsPostRequestTimeout() *PcloudCloudconnectionsPostRequestTimeout { return &PcloudCloudconnectionsPostRequestTimeout{} diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_responses.go index c1c3e716..60397da2 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_responses.go @@ -60,6 +60,12 @@ func (o *PcloudPvminstancesClonePostReader) ReadResponse(response runtime.Client return nil, err } return nil, result + case 410: + result := NewPcloudPvminstancesClonePostGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result case 422: result := NewPcloudPvminstancesClonePostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { @@ -497,6 +503,76 @@ func (o *PcloudPvminstancesClonePostConflict) readResponse(response runtime.Clie return nil } +// NewPcloudPvminstancesClonePostGone creates a PcloudPvminstancesClonePostGone with default headers values +func NewPcloudPvminstancesClonePostGone() *PcloudPvminstancesClonePostGone { + return &PcloudPvminstancesClonePostGone{} +} + +/* +PcloudPvminstancesClonePostGone describes a response with status code 410, with default header values. + +Gone +*/ +type PcloudPvminstancesClonePostGone struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud pvminstances clone post gone response has a 2xx status code +func (o *PcloudPvminstancesClonePostGone) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud pvminstances clone post gone response has a 3xx status code +func (o *PcloudPvminstancesClonePostGone) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances clone post gone response has a 4xx status code +func (o *PcloudPvminstancesClonePostGone) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud pvminstances clone post gone response has a 5xx status code +func (o *PcloudPvminstancesClonePostGone) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances clone post gone response a status code equal to that given +func (o *PcloudPvminstancesClonePostGone) IsCode(code int) bool { + return code == 410 +} + +// Code gets the status code for the pcloud pvminstances clone post gone response +func (o *PcloudPvminstancesClonePostGone) Code() int { + return 410 +} + +func (o *PcloudPvminstancesClonePostGone) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/clone][%d] pcloudPvminstancesClonePostGone %s", 410, payload) +} + +func (o *PcloudPvminstancesClonePostGone) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/clone][%d] pcloudPvminstancesClonePostGone %s", 410, payload) +} + +func (o *PcloudPvminstancesClonePostGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesClonePostGone) 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 +} + // NewPcloudPvminstancesClonePostUnprocessableEntity creates a PcloudPvminstancesClonePostUnprocessableEntity with default headers values func NewPcloudPvminstancesClonePostUnprocessableEntity() *PcloudPvminstancesClonePostUnprocessableEntity { return &PcloudPvminstancesClonePostUnprocessableEntity{} diff --git a/power/client/p_cloud_volumes/p_cloud_volumes_client.go b/power/client/p_cloud_volumes/p_cloud_volumes_client.go index e2bc42c7..219bd859 100644 --- a/power/client/p_cloud_volumes/p_cloud_volumes_client.go +++ b/power/client/p_cloud_volumes/p_cloud_volumes_client.go @@ -94,6 +94,8 @@ type ClientService interface { PcloudV2VolumesDelete(params *PcloudV2VolumesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesDeleteAccepted, *PcloudV2VolumesDeletePartialContent, error) + PcloudV2VolumesGetall(params *PcloudV2VolumesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesGetallOK, error) + PcloudV2VolumesPost(params *PcloudV2VolumesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesPostCreated, error) PcloudV2VolumescloneCancelPost(params *PcloudV2VolumescloneCancelPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneCancelPostAccepted, error) @@ -869,6 +871,45 @@ func (a *Client) PcloudV2VolumesDelete(params *PcloudV2VolumesDeleteParams, auth panic(msg) } +/* +PcloudV2VolumesGetall lists specified volumes for this cloud instance +*/ +func (a *Client) PcloudV2VolumesGetall(params *PcloudV2VolumesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudV2VolumesGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.v2.volumes.getall", + Method: "GET", + PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudV2VolumesGetallReader{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.(*PcloudV2VolumesGetallOK) + 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.v2.volumes.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* PcloudV2VolumesPost creates multiple data volumes from a single definition */ diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumes_getall_parameters.go b/power/client/p_cloud_volumes/pcloud_v2_volumes_getall_parameters.go new file mode 100644 index 00000000..4c668aff --- /dev/null +++ b/power/client/p_cloud_volumes/pcloud_v2_volumes_getall_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudV2VolumesGetallParams creates a new PcloudV2VolumesGetallParams 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 NewPcloudV2VolumesGetallParams() *PcloudV2VolumesGetallParams { + return &PcloudV2VolumesGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudV2VolumesGetallParamsWithTimeout creates a new PcloudV2VolumesGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudV2VolumesGetallParamsWithTimeout(timeout time.Duration) *PcloudV2VolumesGetallParams { + return &PcloudV2VolumesGetallParams{ + timeout: timeout, + } +} + +// NewPcloudV2VolumesGetallParamsWithContext creates a new PcloudV2VolumesGetallParams object +// with the ability to set a context for a request. +func NewPcloudV2VolumesGetallParamsWithContext(ctx context.Context) *PcloudV2VolumesGetallParams { + return &PcloudV2VolumesGetallParams{ + Context: ctx, + } +} + +// NewPcloudV2VolumesGetallParamsWithHTTPClient creates a new PcloudV2VolumesGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudV2VolumesGetallParamsWithHTTPClient(client *http.Client) *PcloudV2VolumesGetallParams { + return &PcloudV2VolumesGetallParams{ + HTTPClient: client, + } +} + +/* +PcloudV2VolumesGetallParams contains all the parameters to send to the API endpoint + + for the pcloud v2 volumes getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudV2VolumesGetallParams struct { + + /* Body. + + Parameters for fetching list of specified volumes + */ + Body *models.GetBulkVolume + + /* 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 v2 volumes getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumesGetallParams) WithDefaults() *PcloudV2VolumesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumes getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud v2 volumes getall params +func (o *PcloudV2VolumesGetallParams) WithTimeout(timeout time.Duration) *PcloudV2VolumesGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud v2 volumes getall params +func (o *PcloudV2VolumesGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud v2 volumes getall params +func (o *PcloudV2VolumesGetallParams) WithContext(ctx context.Context) *PcloudV2VolumesGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud v2 volumes getall params +func (o *PcloudV2VolumesGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud v2 volumes getall params +func (o *PcloudV2VolumesGetallParams) WithHTTPClient(client *http.Client) *PcloudV2VolumesGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud v2 volumes getall params +func (o *PcloudV2VolumesGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud v2 volumes getall params +func (o *PcloudV2VolumesGetallParams) WithBody(body *models.GetBulkVolume) *PcloudV2VolumesGetallParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud v2 volumes getall params +func (o *PcloudV2VolumesGetallParams) SetBody(body *models.GetBulkVolume) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud v2 volumes getall params +func (o *PcloudV2VolumesGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudV2VolumesGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud v2 volumes getall params +func (o *PcloudV2VolumesGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudV2VolumesGetallParams) 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 + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumes_getall_responses.go b/power/client/p_cloud_volumes/pcloud_v2_volumes_getall_responses.go new file mode 100644 index 00000000..8d2120b5 --- /dev/null +++ b/power/client/p_cloud_volumes/pcloud_v2_volumes_getall_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// PcloudV2VolumesGetallReader is a Reader for the PcloudV2VolumesGetall structure. +type PcloudV2VolumesGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudV2VolumesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudV2VolumesGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudV2VolumesGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudV2VolumesGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudV2VolumesGetallForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudV2VolumesGetallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudV2VolumesGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes] pcloud.v2.volumes.getall", response, response.Code()) + } +} + +// NewPcloudV2VolumesGetallOK creates a PcloudV2VolumesGetallOK with default headers values +func NewPcloudV2VolumesGetallOK() *PcloudV2VolumesGetallOK { + return &PcloudV2VolumesGetallOK{} +} + +/* +PcloudV2VolumesGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudV2VolumesGetallOK struct { + Payload *models.Volumes +} + +// IsSuccess returns true when this pcloud v2 volumes getall o k response has a 2xx status code +func (o *PcloudV2VolumesGetallOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this pcloud v2 volumes getall o k response has a 3xx status code +func (o *PcloudV2VolumesGetallOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud v2 volumes getall o k response has a 4xx status code +func (o *PcloudV2VolumesGetallOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud v2 volumes getall o k response has a 5xx status code +func (o *PcloudV2VolumesGetallOK) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud v2 volumes getall o k response a status code equal to that given +func (o *PcloudV2VolumesGetallOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the pcloud v2 volumes getall o k response +func (o *PcloudV2VolumesGetallOK) Code() int { + return 200 +} + +func (o *PcloudV2VolumesGetallOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallOK %s", 200, payload) +} + +func (o *PcloudV2VolumesGetallOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallOK %s", 200, payload) +} + +func (o *PcloudV2VolumesGetallOK) GetPayload() *models.Volumes { + return o.Payload +} + +func (o *PcloudV2VolumesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Volumes) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudV2VolumesGetallBadRequest creates a PcloudV2VolumesGetallBadRequest with default headers values +func NewPcloudV2VolumesGetallBadRequest() *PcloudV2VolumesGetallBadRequest { + return &PcloudV2VolumesGetallBadRequest{} +} + +/* +PcloudV2VolumesGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudV2VolumesGetallBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud v2 volumes getall bad request response has a 2xx status code +func (o *PcloudV2VolumesGetallBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud v2 volumes getall bad request response has a 3xx status code +func (o *PcloudV2VolumesGetallBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud v2 volumes getall bad request response has a 4xx status code +func (o *PcloudV2VolumesGetallBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud v2 volumes getall bad request response has a 5xx status code +func (o *PcloudV2VolumesGetallBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud v2 volumes getall bad request response a status code equal to that given +func (o *PcloudV2VolumesGetallBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the pcloud v2 volumes getall bad request response +func (o *PcloudV2VolumesGetallBadRequest) Code() int { + return 400 +} + +func (o *PcloudV2VolumesGetallBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallBadRequest %s", 400, payload) +} + +func (o *PcloudV2VolumesGetallBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallBadRequest %s", 400, payload) +} + +func (o *PcloudV2VolumesGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesGetallBadRequest) 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 +} + +// NewPcloudV2VolumesGetallUnauthorized creates a PcloudV2VolumesGetallUnauthorized with default headers values +func NewPcloudV2VolumesGetallUnauthorized() *PcloudV2VolumesGetallUnauthorized { + return &PcloudV2VolumesGetallUnauthorized{} +} + +/* +PcloudV2VolumesGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudV2VolumesGetallUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud v2 volumes getall unauthorized response has a 2xx status code +func (o *PcloudV2VolumesGetallUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud v2 volumes getall unauthorized response has a 3xx status code +func (o *PcloudV2VolumesGetallUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud v2 volumes getall unauthorized response has a 4xx status code +func (o *PcloudV2VolumesGetallUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud v2 volumes getall unauthorized response has a 5xx status code +func (o *PcloudV2VolumesGetallUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud v2 volumes getall unauthorized response a status code equal to that given +func (o *PcloudV2VolumesGetallUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the pcloud v2 volumes getall unauthorized response +func (o *PcloudV2VolumesGetallUnauthorized) Code() int { + return 401 +} + +func (o *PcloudV2VolumesGetallUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallUnauthorized %s", 401, payload) +} + +func (o *PcloudV2VolumesGetallUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallUnauthorized %s", 401, payload) +} + +func (o *PcloudV2VolumesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesGetallUnauthorized) 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 +} + +// NewPcloudV2VolumesGetallForbidden creates a PcloudV2VolumesGetallForbidden with default headers values +func NewPcloudV2VolumesGetallForbidden() *PcloudV2VolumesGetallForbidden { + return &PcloudV2VolumesGetallForbidden{} +} + +/* +PcloudV2VolumesGetallForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudV2VolumesGetallForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud v2 volumes getall forbidden response has a 2xx status code +func (o *PcloudV2VolumesGetallForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud v2 volumes getall forbidden response has a 3xx status code +func (o *PcloudV2VolumesGetallForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud v2 volumes getall forbidden response has a 4xx status code +func (o *PcloudV2VolumesGetallForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud v2 volumes getall forbidden response has a 5xx status code +func (o *PcloudV2VolumesGetallForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud v2 volumes getall forbidden response a status code equal to that given +func (o *PcloudV2VolumesGetallForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the pcloud v2 volumes getall forbidden response +func (o *PcloudV2VolumesGetallForbidden) Code() int { + return 403 +} + +func (o *PcloudV2VolumesGetallForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallForbidden %s", 403, payload) +} + +func (o *PcloudV2VolumesGetallForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallForbidden %s", 403, payload) +} + +func (o *PcloudV2VolumesGetallForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesGetallForbidden) 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 +} + +// NewPcloudV2VolumesGetallNotFound creates a PcloudV2VolumesGetallNotFound with default headers values +func NewPcloudV2VolumesGetallNotFound() *PcloudV2VolumesGetallNotFound { + return &PcloudV2VolumesGetallNotFound{} +} + +/* +PcloudV2VolumesGetallNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudV2VolumesGetallNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud v2 volumes getall not found response has a 2xx status code +func (o *PcloudV2VolumesGetallNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud v2 volumes getall not found response has a 3xx status code +func (o *PcloudV2VolumesGetallNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud v2 volumes getall not found response has a 4xx status code +func (o *PcloudV2VolumesGetallNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this pcloud v2 volumes getall not found response has a 5xx status code +func (o *PcloudV2VolumesGetallNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud v2 volumes getall not found response a status code equal to that given +func (o *PcloudV2VolumesGetallNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the pcloud v2 volumes getall not found response +func (o *PcloudV2VolumesGetallNotFound) Code() int { + return 404 +} + +func (o *PcloudV2VolumesGetallNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallNotFound %s", 404, payload) +} + +func (o *PcloudV2VolumesGetallNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallNotFound %s", 404, payload) +} + +func (o *PcloudV2VolumesGetallNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesGetallNotFound) 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 +} + +// NewPcloudV2VolumesGetallInternalServerError creates a PcloudV2VolumesGetallInternalServerError with default headers values +func NewPcloudV2VolumesGetallInternalServerError() *PcloudV2VolumesGetallInternalServerError { + return &PcloudV2VolumesGetallInternalServerError{} +} + +/* +PcloudV2VolumesGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudV2VolumesGetallInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this pcloud v2 volumes getall internal server error response has a 2xx status code +func (o *PcloudV2VolumesGetallInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this pcloud v2 volumes getall internal server error response has a 3xx status code +func (o *PcloudV2VolumesGetallInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud v2 volumes getall internal server error response has a 4xx status code +func (o *PcloudV2VolumesGetallInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud v2 volumes getall internal server error response has a 5xx status code +func (o *PcloudV2VolumesGetallInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this pcloud v2 volumes getall internal server error response a status code equal to that given +func (o *PcloudV2VolumesGetallInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the pcloud v2 volumes getall internal server error response +func (o *PcloudV2VolumesGetallInternalServerError) Code() int { + return 500 +} + +func (o *PcloudV2VolumesGetallInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallInternalServerError %s", 500, payload) +} + +func (o *PcloudV2VolumesGetallInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesGetallInternalServerError %s", 500, payload) +} + +func (o *PcloudV2VolumesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesGetallInternalServerError) 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/snapshots/snapshots_client.go b/power/client/snapshots/snapshots_client.go index 3ad1d9fc..a4864748 100644 --- a/power/client/snapshots/snapshots_client.go +++ b/power/client/snapshots/snapshots_client.go @@ -60,11 +60,21 @@ type ClientService interface { V1SnapshotsGetall(params *V1SnapshotsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1SnapshotsGetallOK, error) + V1VolumeSnapshotsGet(params *V1VolumeSnapshotsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1VolumeSnapshotsGetOK, error) + + V1VolumeSnapshotsGetall(params *V1VolumeSnapshotsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1VolumeSnapshotsGetallOK, error) + SetTransport(transport runtime.ClientTransport) } /* -V1SnapshotsGet gets the detail of a snapshot + V1SnapshotsGet gets the detail of a snapshot + + This API is deprecated for /v1/snapshots. + +The API v1/volume-snapshots has replaced this endpoint. + +View the usage of a snapshot. The snapshot may take time sync because the data is cached. */ func (a *Client) V1SnapshotsGet(params *V1SnapshotsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1SnapshotsGetOK, error) { // TODO: Validate the params before sending @@ -103,7 +113,13 @@ func (a *Client) V1SnapshotsGet(params *V1SnapshotsGetParams, authInfo runtime.C } /* -V1SnapshotsGetall gets a list of all the snapshots on a workspace + V1SnapshotsGetall gets a list of all the snapshots on a workspace + + This API is deprecated for /v1/snapshots. + +The API v1/volume-snapshots has replaced this endpoint. + +View the usage of snapshots on the workspace. The snapshots may take time sync because the data is cached. */ func (a *Client) V1SnapshotsGetall(params *V1SnapshotsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1SnapshotsGetallOK, error) { // TODO: Validate the params before sending @@ -141,6 +157,88 @@ func (a *Client) V1SnapshotsGetall(params *V1SnapshotsGetallParams, authInfo run panic(msg) } +/* +V1VolumeSnapshotsGet gets the detail of a volume snapshot + +View the usage of a snapshot. The snapshot may take time sync because the data is cached. +*/ +func (a *Client) V1VolumeSnapshotsGet(params *V1VolumeSnapshotsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1VolumeSnapshotsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1VolumeSnapshotsGetParams() + } + op := &runtime.ClientOperation{ + ID: "v1.volume-snapshots.get", + Method: "GET", + PathPattern: "/v1/volume-snapshots/{volume_snapshot_uuid}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1VolumeSnapshotsGetReader{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.(*V1VolumeSnapshotsGetOK) + 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.volume-snapshots.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1VolumeSnapshotsGetall gets the list of volume snapshots on a workspace + +View the usage of volume snapshots on the workspace. The volume snapshots may take time sync because the data is cached. +*/ +func (a *Client) V1VolumeSnapshotsGetall(params *V1VolumeSnapshotsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1VolumeSnapshotsGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1VolumeSnapshotsGetallParams() + } + op := &runtime.ClientOperation{ + ID: "v1.volume-snapshots.getall", + Method: "GET", + PathPattern: "/v1/volume-snapshots", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1VolumeSnapshotsGetallReader{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.(*V1VolumeSnapshotsGetallOK) + 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.volume-snapshots.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/snapshots/v1_volume_snapshots_get_parameters.go b/power/client/snapshots/v1_volume_snapshots_get_parameters.go new file mode 100644 index 00000000..2d739ce6 --- /dev/null +++ b/power/client/snapshots/v1_volume_snapshots_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package snapshots + +// 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" +) + +// NewV1VolumeSnapshotsGetParams creates a new V1VolumeSnapshotsGetParams 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 NewV1VolumeSnapshotsGetParams() *V1VolumeSnapshotsGetParams { + return &V1VolumeSnapshotsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1VolumeSnapshotsGetParamsWithTimeout creates a new V1VolumeSnapshotsGetParams object +// with the ability to set a timeout on a request. +func NewV1VolumeSnapshotsGetParamsWithTimeout(timeout time.Duration) *V1VolumeSnapshotsGetParams { + return &V1VolumeSnapshotsGetParams{ + timeout: timeout, + } +} + +// NewV1VolumeSnapshotsGetParamsWithContext creates a new V1VolumeSnapshotsGetParams object +// with the ability to set a context for a request. +func NewV1VolumeSnapshotsGetParamsWithContext(ctx context.Context) *V1VolumeSnapshotsGetParams { + return &V1VolumeSnapshotsGetParams{ + Context: ctx, + } +} + +// NewV1VolumeSnapshotsGetParamsWithHTTPClient creates a new V1VolumeSnapshotsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1VolumeSnapshotsGetParamsWithHTTPClient(client *http.Client) *V1VolumeSnapshotsGetParams { + return &V1VolumeSnapshotsGetParams{ + HTTPClient: client, + } +} + +/* +V1VolumeSnapshotsGetParams contains all the parameters to send to the API endpoint + + for the v1 volume snapshots get operation. + + Typically these are written to a http.Request. +*/ +type V1VolumeSnapshotsGetParams struct { + + /* VolumeSnapshotUUID. + + The volume snapshot UUID + */ + VolumeSnapshotUUID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 volume snapshots get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1VolumeSnapshotsGetParams) WithDefaults() *V1VolumeSnapshotsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 volume snapshots get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1VolumeSnapshotsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 volume snapshots get params +func (o *V1VolumeSnapshotsGetParams) WithTimeout(timeout time.Duration) *V1VolumeSnapshotsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 volume snapshots get params +func (o *V1VolumeSnapshotsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 volume snapshots get params +func (o *V1VolumeSnapshotsGetParams) WithContext(ctx context.Context) *V1VolumeSnapshotsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 volume snapshots get params +func (o *V1VolumeSnapshotsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 volume snapshots get params +func (o *V1VolumeSnapshotsGetParams) WithHTTPClient(client *http.Client) *V1VolumeSnapshotsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 volume snapshots get params +func (o *V1VolumeSnapshotsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithVolumeSnapshotUUID adds the volumeSnapshotUUID to the v1 volume snapshots get params +func (o *V1VolumeSnapshotsGetParams) WithVolumeSnapshotUUID(volumeSnapshotUUID string) *V1VolumeSnapshotsGetParams { + o.SetVolumeSnapshotUUID(volumeSnapshotUUID) + return o +} + +// SetVolumeSnapshotUUID adds the volumeSnapshotUuid to the v1 volume snapshots get params +func (o *V1VolumeSnapshotsGetParams) SetVolumeSnapshotUUID(volumeSnapshotUUID string) { + o.VolumeSnapshotUUID = volumeSnapshotUUID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1VolumeSnapshotsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param volume_snapshot_uuid + if err := r.SetPathParam("volume_snapshot_uuid", o.VolumeSnapshotUUID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/snapshots/v1_volume_snapshots_get_responses.go b/power/client/snapshots/v1_volume_snapshots_get_responses.go new file mode 100644 index 00000000..4402d278 --- /dev/null +++ b/power/client/snapshots/v1_volume_snapshots_get_responses.go @@ -0,0 +1,562 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package snapshots + +// 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" +) + +// V1VolumeSnapshotsGetReader is a Reader for the V1VolumeSnapshotsGet structure. +type V1VolumeSnapshotsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1VolumeSnapshotsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1VolumeSnapshotsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1VolumeSnapshotsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1VolumeSnapshotsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1VolumeSnapshotsGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1VolumeSnapshotsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1VolumeSnapshotsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 503: + result := NewV1VolumeSnapshotsGetServiceUnavailable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/volume-snapshots/{volume_snapshot_uuid}] v1.volume-snapshots.get", response, response.Code()) + } +} + +// NewV1VolumeSnapshotsGetOK creates a V1VolumeSnapshotsGetOK with default headers values +func NewV1VolumeSnapshotsGetOK() *V1VolumeSnapshotsGetOK { + return &V1VolumeSnapshotsGetOK{} +} + +/* +V1VolumeSnapshotsGetOK describes a response with status code 200, with default header values. + +OK +*/ +type V1VolumeSnapshotsGetOK struct { + Payload *models.SnapshotV1 +} + +// IsSuccess returns true when this v1 volume snapshots get o k response has a 2xx status code +func (o *V1VolumeSnapshotsGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 volume snapshots get o k response has a 3xx status code +func (o *V1VolumeSnapshotsGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots get o k response has a 4xx status code +func (o *V1VolumeSnapshotsGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 volume snapshots get o k response has a 5xx status code +func (o *V1VolumeSnapshotsGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 volume snapshots get o k response a status code equal to that given +func (o *V1VolumeSnapshotsGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 volume snapshots get o k response +func (o *V1VolumeSnapshotsGetOK) Code() int { + return 200 +} + +func (o *V1VolumeSnapshotsGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetOK %s", 200, payload) +} + +func (o *V1VolumeSnapshotsGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetOK %s", 200, payload) +} + +func (o *V1VolumeSnapshotsGetOK) GetPayload() *models.SnapshotV1 { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SnapshotV1) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1VolumeSnapshotsGetBadRequest creates a V1VolumeSnapshotsGetBadRequest with default headers values +func NewV1VolumeSnapshotsGetBadRequest() *V1VolumeSnapshotsGetBadRequest { + return &V1VolumeSnapshotsGetBadRequest{} +} + +/* +V1VolumeSnapshotsGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1VolumeSnapshotsGetBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots get bad request response has a 2xx status code +func (o *V1VolumeSnapshotsGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots get bad request response has a 3xx status code +func (o *V1VolumeSnapshotsGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots get bad request response has a 4xx status code +func (o *V1VolumeSnapshotsGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 volume snapshots get bad request response has a 5xx status code +func (o *V1VolumeSnapshotsGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 volume snapshots get bad request response a status code equal to that given +func (o *V1VolumeSnapshotsGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 volume snapshots get bad request response +func (o *V1VolumeSnapshotsGetBadRequest) Code() int { + return 400 +} + +func (o *V1VolumeSnapshotsGetBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetBadRequest %s", 400, payload) +} + +func (o *V1VolumeSnapshotsGetBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetBadRequest %s", 400, payload) +} + +func (o *V1VolumeSnapshotsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetBadRequest) 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 +} + +// NewV1VolumeSnapshotsGetUnauthorized creates a V1VolumeSnapshotsGetUnauthorized with default headers values +func NewV1VolumeSnapshotsGetUnauthorized() *V1VolumeSnapshotsGetUnauthorized { + return &V1VolumeSnapshotsGetUnauthorized{} +} + +/* +V1VolumeSnapshotsGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1VolumeSnapshotsGetUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots get unauthorized response has a 2xx status code +func (o *V1VolumeSnapshotsGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots get unauthorized response has a 3xx status code +func (o *V1VolumeSnapshotsGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots get unauthorized response has a 4xx status code +func (o *V1VolumeSnapshotsGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 volume snapshots get unauthorized response has a 5xx status code +func (o *V1VolumeSnapshotsGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 volume snapshots get unauthorized response a status code equal to that given +func (o *V1VolumeSnapshotsGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 volume snapshots get unauthorized response +func (o *V1VolumeSnapshotsGetUnauthorized) Code() int { + return 401 +} + +func (o *V1VolumeSnapshotsGetUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetUnauthorized %s", 401, payload) +} + +func (o *V1VolumeSnapshotsGetUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetUnauthorized %s", 401, payload) +} + +func (o *V1VolumeSnapshotsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetUnauthorized) 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 +} + +// NewV1VolumeSnapshotsGetForbidden creates a V1VolumeSnapshotsGetForbidden with default headers values +func NewV1VolumeSnapshotsGetForbidden() *V1VolumeSnapshotsGetForbidden { + return &V1VolumeSnapshotsGetForbidden{} +} + +/* +V1VolumeSnapshotsGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1VolumeSnapshotsGetForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots get forbidden response has a 2xx status code +func (o *V1VolumeSnapshotsGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots get forbidden response has a 3xx status code +func (o *V1VolumeSnapshotsGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots get forbidden response has a 4xx status code +func (o *V1VolumeSnapshotsGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 volume snapshots get forbidden response has a 5xx status code +func (o *V1VolumeSnapshotsGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 volume snapshots get forbidden response a status code equal to that given +func (o *V1VolumeSnapshotsGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 volume snapshots get forbidden response +func (o *V1VolumeSnapshotsGetForbidden) Code() int { + return 403 +} + +func (o *V1VolumeSnapshotsGetForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetForbidden %s", 403, payload) +} + +func (o *V1VolumeSnapshotsGetForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetForbidden %s", 403, payload) +} + +func (o *V1VolumeSnapshotsGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetForbidden) 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 +} + +// NewV1VolumeSnapshotsGetNotFound creates a V1VolumeSnapshotsGetNotFound with default headers values +func NewV1VolumeSnapshotsGetNotFound() *V1VolumeSnapshotsGetNotFound { + return &V1VolumeSnapshotsGetNotFound{} +} + +/* +V1VolumeSnapshotsGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1VolumeSnapshotsGetNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots get not found response has a 2xx status code +func (o *V1VolumeSnapshotsGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots get not found response has a 3xx status code +func (o *V1VolumeSnapshotsGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots get not found response has a 4xx status code +func (o *V1VolumeSnapshotsGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 volume snapshots get not found response has a 5xx status code +func (o *V1VolumeSnapshotsGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 volume snapshots get not found response a status code equal to that given +func (o *V1VolumeSnapshotsGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 volume snapshots get not found response +func (o *V1VolumeSnapshotsGetNotFound) Code() int { + return 404 +} + +func (o *V1VolumeSnapshotsGetNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetNotFound %s", 404, payload) +} + +func (o *V1VolumeSnapshotsGetNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetNotFound %s", 404, payload) +} + +func (o *V1VolumeSnapshotsGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetNotFound) 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 +} + +// NewV1VolumeSnapshotsGetInternalServerError creates a V1VolumeSnapshotsGetInternalServerError with default headers values +func NewV1VolumeSnapshotsGetInternalServerError() *V1VolumeSnapshotsGetInternalServerError { + return &V1VolumeSnapshotsGetInternalServerError{} +} + +/* +V1VolumeSnapshotsGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1VolumeSnapshotsGetInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots get internal server error response has a 2xx status code +func (o *V1VolumeSnapshotsGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots get internal server error response has a 3xx status code +func (o *V1VolumeSnapshotsGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots get internal server error response has a 4xx status code +func (o *V1VolumeSnapshotsGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 volume snapshots get internal server error response has a 5xx status code +func (o *V1VolumeSnapshotsGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 volume snapshots get internal server error response a status code equal to that given +func (o *V1VolumeSnapshotsGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 volume snapshots get internal server error response +func (o *V1VolumeSnapshotsGetInternalServerError) Code() int { + return 500 +} + +func (o *V1VolumeSnapshotsGetInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetInternalServerError %s", 500, payload) +} + +func (o *V1VolumeSnapshotsGetInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetInternalServerError %s", 500, payload) +} + +func (o *V1VolumeSnapshotsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetInternalServerError) 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 +} + +// NewV1VolumeSnapshotsGetServiceUnavailable creates a V1VolumeSnapshotsGetServiceUnavailable with default headers values +func NewV1VolumeSnapshotsGetServiceUnavailable() *V1VolumeSnapshotsGetServiceUnavailable { + return &V1VolumeSnapshotsGetServiceUnavailable{} +} + +/* +V1VolumeSnapshotsGetServiceUnavailable describes a response with status code 503, with default header values. + +Service Unavailable +*/ +type V1VolumeSnapshotsGetServiceUnavailable struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots get service unavailable response has a 2xx status code +func (o *V1VolumeSnapshotsGetServiceUnavailable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots get service unavailable response has a 3xx status code +func (o *V1VolumeSnapshotsGetServiceUnavailable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots get service unavailable response has a 4xx status code +func (o *V1VolumeSnapshotsGetServiceUnavailable) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 volume snapshots get service unavailable response has a 5xx status code +func (o *V1VolumeSnapshotsGetServiceUnavailable) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 volume snapshots get service unavailable response a status code equal to that given +func (o *V1VolumeSnapshotsGetServiceUnavailable) IsCode(code int) bool { + return code == 503 +} + +// Code gets the status code for the v1 volume snapshots get service unavailable response +func (o *V1VolumeSnapshotsGetServiceUnavailable) Code() int { + return 503 +} + +func (o *V1VolumeSnapshotsGetServiceUnavailable) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetServiceUnavailable %s", 503, payload) +} + +func (o *V1VolumeSnapshotsGetServiceUnavailable) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots/{volume_snapshot_uuid}][%d] v1VolumeSnapshotsGetServiceUnavailable %s", 503, payload) +} + +func (o *V1VolumeSnapshotsGetServiceUnavailable) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetServiceUnavailable) 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/snapshots/v1_volume_snapshots_getall_parameters.go b/power/client/snapshots/v1_volume_snapshots_getall_parameters.go new file mode 100644 index 00000000..5b96fcd1 --- /dev/null +++ b/power/client/snapshots/v1_volume_snapshots_getall_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package snapshots + +// 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" +) + +// NewV1VolumeSnapshotsGetallParams creates a new V1VolumeSnapshotsGetallParams 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 NewV1VolumeSnapshotsGetallParams() *V1VolumeSnapshotsGetallParams { + return &V1VolumeSnapshotsGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1VolumeSnapshotsGetallParamsWithTimeout creates a new V1VolumeSnapshotsGetallParams object +// with the ability to set a timeout on a request. +func NewV1VolumeSnapshotsGetallParamsWithTimeout(timeout time.Duration) *V1VolumeSnapshotsGetallParams { + return &V1VolumeSnapshotsGetallParams{ + timeout: timeout, + } +} + +// NewV1VolumeSnapshotsGetallParamsWithContext creates a new V1VolumeSnapshotsGetallParams object +// with the ability to set a context for a request. +func NewV1VolumeSnapshotsGetallParamsWithContext(ctx context.Context) *V1VolumeSnapshotsGetallParams { + return &V1VolumeSnapshotsGetallParams{ + Context: ctx, + } +} + +// NewV1VolumeSnapshotsGetallParamsWithHTTPClient creates a new V1VolumeSnapshotsGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1VolumeSnapshotsGetallParamsWithHTTPClient(client *http.Client) *V1VolumeSnapshotsGetallParams { + return &V1VolumeSnapshotsGetallParams{ + HTTPClient: client, + } +} + +/* +V1VolumeSnapshotsGetallParams contains all the parameters to send to the API endpoint + + for the v1 volume snapshots getall operation. + + Typically these are written to a http.Request. +*/ +type V1VolumeSnapshotsGetallParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 volume snapshots getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1VolumeSnapshotsGetallParams) WithDefaults() *V1VolumeSnapshotsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 volume snapshots getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1VolumeSnapshotsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 volume snapshots getall params +func (o *V1VolumeSnapshotsGetallParams) WithTimeout(timeout time.Duration) *V1VolumeSnapshotsGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 volume snapshots getall params +func (o *V1VolumeSnapshotsGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 volume snapshots getall params +func (o *V1VolumeSnapshotsGetallParams) WithContext(ctx context.Context) *V1VolumeSnapshotsGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 volume snapshots getall params +func (o *V1VolumeSnapshotsGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 volume snapshots getall params +func (o *V1VolumeSnapshotsGetallParams) WithHTTPClient(client *http.Client) *V1VolumeSnapshotsGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 volume snapshots getall params +func (o *V1VolumeSnapshotsGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *V1VolumeSnapshotsGetallParams) 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/snapshots/v1_volume_snapshots_getall_responses.go b/power/client/snapshots/v1_volume_snapshots_getall_responses.go new file mode 100644 index 00000000..525835e8 --- /dev/null +++ b/power/client/snapshots/v1_volume_snapshots_getall_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package snapshots + +// 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" +) + +// V1VolumeSnapshotsGetallReader is a Reader for the V1VolumeSnapshotsGetall structure. +type V1VolumeSnapshotsGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1VolumeSnapshotsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1VolumeSnapshotsGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewV1VolumeSnapshotsGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1VolumeSnapshotsGetallForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1VolumeSnapshotsGetallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1VolumeSnapshotsGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 503: + result := NewV1VolumeSnapshotsGetallServiceUnavailable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/volume-snapshots] v1.volume-snapshots.getall", response, response.Code()) + } +} + +// NewV1VolumeSnapshotsGetallOK creates a V1VolumeSnapshotsGetallOK with default headers values +func NewV1VolumeSnapshotsGetallOK() *V1VolumeSnapshotsGetallOK { + return &V1VolumeSnapshotsGetallOK{} +} + +/* +V1VolumeSnapshotsGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type V1VolumeSnapshotsGetallOK struct { + Payload *models.VolumeSnapshotList +} + +// IsSuccess returns true when this v1 volume snapshots getall o k response has a 2xx status code +func (o *V1VolumeSnapshotsGetallOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 volume snapshots getall o k response has a 3xx status code +func (o *V1VolumeSnapshotsGetallOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots getall o k response has a 4xx status code +func (o *V1VolumeSnapshotsGetallOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 volume snapshots getall o k response has a 5xx status code +func (o *V1VolumeSnapshotsGetallOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 volume snapshots getall o k response a status code equal to that given +func (o *V1VolumeSnapshotsGetallOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 volume snapshots getall o k response +func (o *V1VolumeSnapshotsGetallOK) Code() int { + return 200 +} + +func (o *V1VolumeSnapshotsGetallOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallOK %s", 200, payload) +} + +func (o *V1VolumeSnapshotsGetallOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallOK %s", 200, payload) +} + +func (o *V1VolumeSnapshotsGetallOK) GetPayload() *models.VolumeSnapshotList { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.VolumeSnapshotList) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1VolumeSnapshotsGetallUnauthorized creates a V1VolumeSnapshotsGetallUnauthorized with default headers values +func NewV1VolumeSnapshotsGetallUnauthorized() *V1VolumeSnapshotsGetallUnauthorized { + return &V1VolumeSnapshotsGetallUnauthorized{} +} + +/* +V1VolumeSnapshotsGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1VolumeSnapshotsGetallUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots getall unauthorized response has a 2xx status code +func (o *V1VolumeSnapshotsGetallUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots getall unauthorized response has a 3xx status code +func (o *V1VolumeSnapshotsGetallUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots getall unauthorized response has a 4xx status code +func (o *V1VolumeSnapshotsGetallUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 volume snapshots getall unauthorized response has a 5xx status code +func (o *V1VolumeSnapshotsGetallUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 volume snapshots getall unauthorized response a status code equal to that given +func (o *V1VolumeSnapshotsGetallUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 volume snapshots getall unauthorized response +func (o *V1VolumeSnapshotsGetallUnauthorized) Code() int { + return 401 +} + +func (o *V1VolumeSnapshotsGetallUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallUnauthorized %s", 401, payload) +} + +func (o *V1VolumeSnapshotsGetallUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallUnauthorized %s", 401, payload) +} + +func (o *V1VolumeSnapshotsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetallUnauthorized) 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 +} + +// NewV1VolumeSnapshotsGetallForbidden creates a V1VolumeSnapshotsGetallForbidden with default headers values +func NewV1VolumeSnapshotsGetallForbidden() *V1VolumeSnapshotsGetallForbidden { + return &V1VolumeSnapshotsGetallForbidden{} +} + +/* +V1VolumeSnapshotsGetallForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1VolumeSnapshotsGetallForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots getall forbidden response has a 2xx status code +func (o *V1VolumeSnapshotsGetallForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots getall forbidden response has a 3xx status code +func (o *V1VolumeSnapshotsGetallForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots getall forbidden response has a 4xx status code +func (o *V1VolumeSnapshotsGetallForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 volume snapshots getall forbidden response has a 5xx status code +func (o *V1VolumeSnapshotsGetallForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 volume snapshots getall forbidden response a status code equal to that given +func (o *V1VolumeSnapshotsGetallForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 volume snapshots getall forbidden response +func (o *V1VolumeSnapshotsGetallForbidden) Code() int { + return 403 +} + +func (o *V1VolumeSnapshotsGetallForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallForbidden %s", 403, payload) +} + +func (o *V1VolumeSnapshotsGetallForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallForbidden %s", 403, payload) +} + +func (o *V1VolumeSnapshotsGetallForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetallForbidden) 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 +} + +// NewV1VolumeSnapshotsGetallNotFound creates a V1VolumeSnapshotsGetallNotFound with default headers values +func NewV1VolumeSnapshotsGetallNotFound() *V1VolumeSnapshotsGetallNotFound { + return &V1VolumeSnapshotsGetallNotFound{} +} + +/* +V1VolumeSnapshotsGetallNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1VolumeSnapshotsGetallNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots getall not found response has a 2xx status code +func (o *V1VolumeSnapshotsGetallNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots getall not found response has a 3xx status code +func (o *V1VolumeSnapshotsGetallNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots getall not found response has a 4xx status code +func (o *V1VolumeSnapshotsGetallNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 volume snapshots getall not found response has a 5xx status code +func (o *V1VolumeSnapshotsGetallNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 volume snapshots getall not found response a status code equal to that given +func (o *V1VolumeSnapshotsGetallNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 volume snapshots getall not found response +func (o *V1VolumeSnapshotsGetallNotFound) Code() int { + return 404 +} + +func (o *V1VolumeSnapshotsGetallNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallNotFound %s", 404, payload) +} + +func (o *V1VolumeSnapshotsGetallNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallNotFound %s", 404, payload) +} + +func (o *V1VolumeSnapshotsGetallNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetallNotFound) 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 +} + +// NewV1VolumeSnapshotsGetallInternalServerError creates a V1VolumeSnapshotsGetallInternalServerError with default headers values +func NewV1VolumeSnapshotsGetallInternalServerError() *V1VolumeSnapshotsGetallInternalServerError { + return &V1VolumeSnapshotsGetallInternalServerError{} +} + +/* +V1VolumeSnapshotsGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1VolumeSnapshotsGetallInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots getall internal server error response has a 2xx status code +func (o *V1VolumeSnapshotsGetallInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots getall internal server error response has a 3xx status code +func (o *V1VolumeSnapshotsGetallInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots getall internal server error response has a 4xx status code +func (o *V1VolumeSnapshotsGetallInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 volume snapshots getall internal server error response has a 5xx status code +func (o *V1VolumeSnapshotsGetallInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 volume snapshots getall internal server error response a status code equal to that given +func (o *V1VolumeSnapshotsGetallInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 volume snapshots getall internal server error response +func (o *V1VolumeSnapshotsGetallInternalServerError) Code() int { + return 500 +} + +func (o *V1VolumeSnapshotsGetallInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallInternalServerError %s", 500, payload) +} + +func (o *V1VolumeSnapshotsGetallInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallInternalServerError %s", 500, payload) +} + +func (o *V1VolumeSnapshotsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetallInternalServerError) 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 +} + +// NewV1VolumeSnapshotsGetallServiceUnavailable creates a V1VolumeSnapshotsGetallServiceUnavailable with default headers values +func NewV1VolumeSnapshotsGetallServiceUnavailable() *V1VolumeSnapshotsGetallServiceUnavailable { + return &V1VolumeSnapshotsGetallServiceUnavailable{} +} + +/* +V1VolumeSnapshotsGetallServiceUnavailable describes a response with status code 503, with default header values. + +Service Unavailable +*/ +type V1VolumeSnapshotsGetallServiceUnavailable struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 volume snapshots getall service unavailable response has a 2xx status code +func (o *V1VolumeSnapshotsGetallServiceUnavailable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 volume snapshots getall service unavailable response has a 3xx status code +func (o *V1VolumeSnapshotsGetallServiceUnavailable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 volume snapshots getall service unavailable response has a 4xx status code +func (o *V1VolumeSnapshotsGetallServiceUnavailable) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 volume snapshots getall service unavailable response has a 5xx status code +func (o *V1VolumeSnapshotsGetallServiceUnavailable) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 volume snapshots getall service unavailable response a status code equal to that given +func (o *V1VolumeSnapshotsGetallServiceUnavailable) IsCode(code int) bool { + return code == 503 +} + +// Code gets the status code for the v1 volume snapshots getall service unavailable response +func (o *V1VolumeSnapshotsGetallServiceUnavailable) Code() int { + return 503 +} + +func (o *V1VolumeSnapshotsGetallServiceUnavailable) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallServiceUnavailable %s", 503, payload) +} + +func (o *V1VolumeSnapshotsGetallServiceUnavailable) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/volume-snapshots][%d] v1VolumeSnapshotsGetallServiceUnavailable %s", 503, payload) +} + +func (o *V1VolumeSnapshotsGetallServiceUnavailable) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1VolumeSnapshotsGetallServiceUnavailable) 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/models/add_host.go b/power/models/add_host.go index b0e6358a..b4220ea7 100644 --- a/power/models/add_host.go +++ b/power/models/add_host.go @@ -26,6 +26,9 @@ type AddHost struct { // System type // Required: true SysType *string `json:"sysType"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this add host @@ -40,6 +43,10 @@ func (m *AddHost) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -64,8 +71,48 @@ func (m *AddHost) validateSysType(formats strfmt.Registry) error { return nil } -// ContextValidate validates this add host based on context it is used +func (m *AddHost) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + +// ContextValidate validate this add host based on the context it is used func (m *AddHost) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AddHost) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } diff --git a/power/models/c_r_n.go b/power/models/c_r_n.go new file mode 100644 index 00000000..5dbfb827 --- /dev/null +++ b/power/models/c_r_n.go @@ -0,0 +1,27 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" +) + +// CRN The CRN for this resource +// +// swagger:model CRN +type CRN string + +// Validate validates this c r n +func (m CRN) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this c r n based on context it is used +func (m CRN) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/power/models/capabilities_details.go b/power/models/capabilities_details.go new file mode 100644 index 00000000..9f11c204 --- /dev/null +++ b/power/models/capabilities_details.go @@ -0,0 +1,157 @@ +// 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" +) + +// CapabilitiesDetails capabilities details +// +// swagger:model CapabilitiesDetails +type CapabilitiesDetails struct { + + // Disaster Recovery Information + // Required: true + DisasterRecovery *DisasterRecovery `json:"disasterRecovery"` + + // Datacenter System Types Information + // Required: true + SupportedSystems *SupportedSystems `json:"supportedSystems"` +} + +// Validate validates this capabilities details +func (m *CapabilitiesDetails) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDisasterRecovery(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSupportedSystems(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CapabilitiesDetails) validateDisasterRecovery(formats strfmt.Registry) error { + + if err := validate.Required("disasterRecovery", "body", m.DisasterRecovery); err != nil { + return err + } + + if m.DisasterRecovery != nil { + if err := m.DisasterRecovery.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("disasterRecovery") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("disasterRecovery") + } + return err + } + } + + return nil +} + +func (m *CapabilitiesDetails) validateSupportedSystems(formats strfmt.Registry) error { + + if err := validate.Required("supportedSystems", "body", m.SupportedSystems); err != nil { + return err + } + + if m.SupportedSystems != nil { + if err := m.SupportedSystems.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("supportedSystems") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("supportedSystems") + } + return err + } + } + + return nil +} + +// ContextValidate validate this capabilities details based on the context it is used +func (m *CapabilitiesDetails) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDisasterRecovery(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSupportedSystems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CapabilitiesDetails) contextValidateDisasterRecovery(ctx context.Context, formats strfmt.Registry) error { + + if m.DisasterRecovery != nil { + + if err := m.DisasterRecovery.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("disasterRecovery") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("disasterRecovery") + } + return err + } + } + + return nil +} + +func (m *CapabilitiesDetails) contextValidateSupportedSystems(ctx context.Context, formats strfmt.Registry) error { + + if m.SupportedSystems != nil { + + if err := m.SupportedSystems.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("supportedSystems") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("supportedSystems") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CapabilitiesDetails) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CapabilitiesDetails) UnmarshalBinary(b []byte) error { + var res CapabilitiesDetails + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/create_cos_image_import_job.go b/power/models/create_cos_image_import_job.go index 642f5675..9c83a7b5 100644 --- a/power/models/create_cos_image_import_job.go +++ b/power/models/create_cos_image_import_job.go @@ -64,6 +64,9 @@ type CreateCosImageImportJob struct { // Type of storage; If only using storageType for storage selection then the storage pool with the most available space will be selected if storageType is not provided the storage type will default to 'tier3'. StorageType string `json:"storageType,omitempty"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this create cos image import job @@ -102,6 +105,10 @@ func (m *CreateCosImageImportJob) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -272,6 +279,23 @@ func (m *CreateCosImageImportJob) validateStorageAffinity(formats strfmt.Registr return nil } +func (m *CreateCosImageImportJob) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // ContextValidate validate this create cos image import job based on the context it is used func (m *CreateCosImageImportJob) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -284,6 +308,10 @@ func (m *CreateCosImageImportJob) ContextValidate(ctx context.Context, formats s res = append(res, err) } + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -332,6 +360,20 @@ func (m *CreateCosImageImportJob) contextValidateStorageAffinity(ctx context.Con return nil } +func (m *CreateCosImageImportJob) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *CreateCosImageImportJob) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/create_data_volume.go b/power/models/create_data_volume.go index 52d2a500..aa2aafc2 100644 --- a/power/models/create_data_volume.go +++ b/power/models/create_data_volume.go @@ -46,8 +46,8 @@ type CreateDataVolume struct { // Indicates if the volume should be replication enabled or not ReplicationEnabled *bool `json:"replicationEnabled,omitempty"` - // List of replication sites for volume replication - ReplicationSite []string `json:"replicationSite,omitempty"` + // List of replication site for volume replication + ReplicationSites []string `json:"replicationSites,omitempty"` // Indicates if the volume is shareable between VMs Shareable *bool `json:"shareable,omitempty"` @@ -56,6 +56,9 @@ type CreateDataVolume struct { // Required: true Size *float64 `json:"size"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // Volume pool where the volume will be created; if provided then affinityPolicy value will be ignored VolumePool string `json:"volumePool,omitempty"` } @@ -76,6 +79,10 @@ func (m *CreateDataVolume) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -142,8 +149,48 @@ func (m *CreateDataVolume) validateSize(formats strfmt.Registry) error { return nil } -// ContextValidate validates this create data volume based on context it is used +func (m *CreateDataVolume) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + +// ContextValidate validate this create data volume based on the context it is used func (m *CreateDataVolume) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateDataVolume) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } diff --git a/power/models/create_image.go b/power/models/create_image.go index d109378b..6603970b 100644 --- a/power/models/create_image.go +++ b/power/models/create_image.go @@ -63,6 +63,9 @@ type CreateImage struct { // Storage pool where the image will be loaded; if provided then storageAffinity will be ignored; Used only when importing an image from cloud storage. StoragePool string `json:"storagePool,omitempty"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this create image @@ -81,6 +84,10 @@ func (m *CreateImage) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -197,6 +204,23 @@ func (m *CreateImage) validateStorageAffinity(formats strfmt.Registry) error { return nil } +func (m *CreateImage) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // ContextValidate validate this create image based on the context it is used func (m *CreateImage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -205,6 +229,10 @@ func (m *CreateImage) ContextValidate(ctx context.Context, formats strfmt.Regist res = append(res, err) } + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -232,6 +260,20 @@ func (m *CreateImage) contextValidateStorageAffinity(ctx context.Context, format return nil } +func (m *CreateImage) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *CreateImage) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/datacenter.go b/power/models/datacenter.go index 2c33b15c..4dae0a17 100644 --- a/power/models/datacenter.go +++ b/power/models/datacenter.go @@ -24,6 +24,9 @@ type Datacenter struct { // Required: true Capabilities map[string]bool `json:"capabilities"` + // Additional Datacenter Capabilities Details + CapabilitiesDetails *CapabilitiesDetails `json:"capabilitiesDetails,omitempty"` + // Link to Datacenter Region Href string `json:"href,omitempty"` @@ -50,6 +53,10 @@ func (m *Datacenter) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCapabilitiesDetails(formats); err != nil { + res = append(res, err) + } + if err := m.validateLocation(formats); err != nil { res = append(res, err) } @@ -77,6 +84,25 @@ func (m *Datacenter) validateCapabilities(formats strfmt.Registry) error { return nil } +func (m *Datacenter) validateCapabilitiesDetails(formats strfmt.Registry) error { + if swag.IsZero(m.CapabilitiesDetails) { // not required + return nil + } + + if m.CapabilitiesDetails != nil { + if err := m.CapabilitiesDetails.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("capabilitiesDetails") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("capabilitiesDetails") + } + return err + } + } + + return nil +} + func (m *Datacenter) validateLocation(formats strfmt.Registry) error { if err := validate.Required("location", "body", m.Location); err != nil { @@ -190,6 +216,10 @@ func (m *Datacenter) validateType(formats strfmt.Registry) error { func (m *Datacenter) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error + if err := m.contextValidateCapabilitiesDetails(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateLocation(ctx, formats); err != nil { res = append(res, err) } @@ -200,6 +230,27 @@ func (m *Datacenter) ContextValidate(ctx context.Context, formats strfmt.Registr return nil } +func (m *Datacenter) contextValidateCapabilitiesDetails(ctx context.Context, formats strfmt.Registry) error { + + if m.CapabilitiesDetails != nil { + + if swag.IsZero(m.CapabilitiesDetails) { // not required + return nil + } + + if err := m.CapabilitiesDetails.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("capabilitiesDetails") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("capabilitiesDetails") + } + return err + } + } + + return nil +} + func (m *Datacenter) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error { if m.Location != nil { diff --git a/power/models/datacenter_location.go b/power/models/datacenter_location.go index 2e0fb838..a3bbcd91 100644 --- a/power/models/datacenter_location.go +++ b/power/models/datacenter_location.go @@ -23,6 +23,10 @@ type DatacenterLocation struct { // Required: true Region *string `json:"region"` + // The Datacenter location region display name + // Required: true + RegionDisplayName *string `json:"regionDisplayName"` + // The Datacenter location region type // Required: true Type *string `json:"type"` @@ -40,6 +44,10 @@ func (m *DatacenterLocation) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateRegionDisplayName(formats); err != nil { + res = append(res, err) + } + if err := m.validateType(formats); err != nil { res = append(res, err) } @@ -63,6 +71,15 @@ func (m *DatacenterLocation) validateRegion(formats strfmt.Registry) error { return nil } +func (m *DatacenterLocation) validateRegionDisplayName(formats strfmt.Registry) error { + + if err := validate.Required("regionDisplayName", "body", m.RegionDisplayName); err != nil { + return err + } + + return nil +} + func (m *DatacenterLocation) validateType(formats strfmt.Registry) error { if err := validate.Required("type", "body", m.Type); err != nil { diff --git a/power/models/disaster_recovery.go b/power/models/disaster_recovery.go new file mode 100644 index 00000000..f3e56e0c --- /dev/null +++ b/power/models/disaster_recovery.go @@ -0,0 +1,159 @@ +// 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" +) + +// DisasterRecovery disaster recovery +// +// swagger:model DisasterRecovery +type DisasterRecovery struct { + + // Asynchronous Replication Target Information + // Required: true + AsynchronousReplication *ReplicationService `json:"asynchronousReplication"` + + // Synchronous Replication Target Information + SynchronousReplication *ReplicationService `json:"synchronousReplication,omitempty"` +} + +// Validate validates this disaster recovery +func (m *DisasterRecovery) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAsynchronousReplication(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSynchronousReplication(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DisasterRecovery) validateAsynchronousReplication(formats strfmt.Registry) error { + + if err := validate.Required("asynchronousReplication", "body", m.AsynchronousReplication); err != nil { + return err + } + + if m.AsynchronousReplication != nil { + if err := m.AsynchronousReplication.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("asynchronousReplication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("asynchronousReplication") + } + return err + } + } + + return nil +} + +func (m *DisasterRecovery) validateSynchronousReplication(formats strfmt.Registry) error { + if swag.IsZero(m.SynchronousReplication) { // not required + return nil + } + + if m.SynchronousReplication != nil { + if err := m.SynchronousReplication.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("synchronousReplication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("synchronousReplication") + } + return err + } + } + + return nil +} + +// ContextValidate validate this disaster recovery based on the context it is used +func (m *DisasterRecovery) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAsynchronousReplication(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSynchronousReplication(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DisasterRecovery) contextValidateAsynchronousReplication(ctx context.Context, formats strfmt.Registry) error { + + if m.AsynchronousReplication != nil { + + if err := m.AsynchronousReplication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("asynchronousReplication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("asynchronousReplication") + } + return err + } + } + + return nil +} + +func (m *DisasterRecovery) contextValidateSynchronousReplication(ctx context.Context, formats strfmt.Registry) error { + + if m.SynchronousReplication != nil { + + if swag.IsZero(m.SynchronousReplication) { // not required + return nil + } + + if err := m.SynchronousReplication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("synchronousReplication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("synchronousReplication") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *DisasterRecovery) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DisasterRecovery) UnmarshalBinary(b []byte) error { + var res DisasterRecovery + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/get_bulk_volume.go b/power/models/get_bulk_volume.go new file mode 100644 index 00000000..0a72234d --- /dev/null +++ b/power/models/get_bulk_volume.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" +) + +// GetBulkVolume get bulk volume +// +// swagger:model GetBulkVolume +type GetBulkVolume struct { + + // List of volumes to be fetched + // Required: true + VolumeList []string `json:"volumeList"` +} + +// Validate validates this get bulk volume +func (m *GetBulkVolume) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVolumeList(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetBulkVolume) validateVolumeList(formats strfmt.Registry) error { + + if err := validate.Required("volumeList", "body", m.VolumeList); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this get bulk volume based on context it is used +func (m *GetBulkVolume) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *GetBulkVolume) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GetBulkVolume) UnmarshalBinary(b []byte) error { + var res GetBulkVolume + 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 51e2d4a4..d1a86cc8 100644 --- a/power/models/host.go +++ b/power/models/host.go @@ -21,6 +21,9 @@ type Host struct { // Capacities of the host Capacity *HostCapacity `json:"capacity,omitempty"` + // crn + Crn CRN `json:"crn,omitempty"` + // Name of the host (chosen by the user) DisplayName string `json:"displayName,omitempty"` @@ -38,6 +41,9 @@ type Host struct { // System type SysType string `json:"sysType,omitempty"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this host @@ -48,10 +54,18 @@ func (m *Host) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateHostGroup(formats); err != nil { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -77,6 +91,23 @@ func (m *Host) validateCapacity(formats strfmt.Registry) error { return nil } +func (m *Host) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *Host) validateHostGroup(formats strfmt.Registry) error { if swag.IsZero(m.HostGroup) { // not required return nil @@ -96,6 +127,23 @@ func (m *Host) validateHostGroup(formats strfmt.Registry) error { return nil } +func (m *Host) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // ContextValidate validate this host based on the context it is used func (m *Host) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -104,10 +152,18 @@ func (m *Host) ContextValidate(ctx context.Context, formats strfmt.Registry) err res = append(res, err) } + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateHostGroup(ctx, formats); err != nil { res = append(res, err) } + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -135,6 +191,24 @@ func (m *Host) contextValidateCapacity(ctx context.Context, formats strfmt.Regis return nil } +func (m *Host) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *Host) contextValidateHostGroup(ctx context.Context, formats strfmt.Registry) error { if m.HostGroup != nil { @@ -156,6 +230,20 @@ func (m *Host) contextValidateHostGroup(ctx context.Context, formats strfmt.Regi return nil } +func (m *Host) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *Host) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/image.go b/power/models/image.go index 97b0ba08..20bc26d8 100644 --- a/power/models/image.go +++ b/power/models/image.go @@ -25,6 +25,9 @@ type Image struct { // Format: date-time CreationDate *strfmt.DateTime `json:"creationDate"` + // crn + Crn CRN `json:"crn,omitempty"` + // Description Description string `json:"description,omitempty"` @@ -69,6 +72,9 @@ type Image struct { // taskref Taskref *TaskReference `json:"taskref,omitempty"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // Image Volumes Volumes []*ImageVolume `json:"volumes"` } @@ -81,6 +87,10 @@ func (m *Image) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateImageID(formats); err != nil { res = append(res, err) } @@ -117,6 +127,10 @@ func (m *Image) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if err := m.validateVolumes(formats); err != nil { res = append(res, err) } @@ -140,6 +154,23 @@ func (m *Image) validateCreationDate(formats strfmt.Registry) error { return nil } +func (m *Image) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *Image) validateImageID(formats strfmt.Registry) error { if err := validate.Required("imageID", "body", m.ImageID); err != nil { @@ -245,6 +276,23 @@ func (m *Image) validateTaskref(formats strfmt.Registry) error { return nil } +func (m *Image) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + func (m *Image) validateVolumes(formats strfmt.Registry) error { if swag.IsZero(m.Volumes) { // not required return nil @@ -275,6 +323,10 @@ func (m *Image) validateVolumes(formats strfmt.Registry) error { func (m *Image) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateSpecifications(ctx, formats); err != nil { res = append(res, err) } @@ -283,6 +335,10 @@ func (m *Image) ContextValidate(ctx context.Context, formats strfmt.Registry) er res = append(res, err) } + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateVolumes(ctx, formats); err != nil { res = append(res, err) } @@ -293,6 +349,24 @@ func (m *Image) ContextValidate(ctx context.Context, formats strfmt.Registry) er return nil } +func (m *Image) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *Image) contextValidateSpecifications(ctx context.Context, formats strfmt.Registry) error { if m.Specifications != nil { @@ -335,6 +409,20 @@ func (m *Image) contextValidateTaskref(ctx context.Context, formats strfmt.Regis return nil } +func (m *Image) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + func (m *Image) contextValidateVolumes(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Volumes); i++ { diff --git a/power/models/image_reference.go b/power/models/image_reference.go index bd1811be..02a984cb 100644 --- a/power/models/image_reference.go +++ b/power/models/image_reference.go @@ -24,6 +24,9 @@ type ImageReference struct { // Format: date-time CreationDate *strfmt.DateTime `json:"creationDate"` + // crn + Crn CRN `json:"crn,omitempty"` + // Description // Required: true Description *string `json:"description"` @@ -70,6 +73,10 @@ func (m *ImageReference) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateDescription(formats); err != nil { res = append(res, err) } @@ -125,6 +132,23 @@ func (m *ImageReference) validateCreationDate(formats strfmt.Registry) error { return nil } +func (m *ImageReference) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *ImageReference) validateDescription(formats strfmt.Registry) error { if err := validate.Required("description", "body", m.Description); err != nil { @@ -225,6 +249,10 @@ func (m *ImageReference) validateStorageType(formats strfmt.Registry) error { func (m *ImageReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateSpecifications(ctx, formats); err != nil { res = append(res, err) } @@ -235,6 +263,24 @@ func (m *ImageReference) ContextValidate(ctx context.Context, formats strfmt.Reg return nil } +func (m *ImageReference) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *ImageReference) contextValidateSpecifications(ctx context.Context, formats strfmt.Registry) error { if m.Specifications != nil { diff --git a/power/models/image_specifications.go b/power/models/image_specifications.go index d5f71a0e..70ec4210 100644 --- a/power/models/image_specifications.go +++ b/power/models/image_specifications.go @@ -37,6 +37,9 @@ type ImageSpecifications struct { // Operating System OperatingSystem string `json:"operatingSystem,omitempty"` + + // Checksum of the source file (imported images only) + SourceChecksum string `json:"sourceChecksum,omitempty"` } // Validate validates this image specifications diff --git a/power/models/multi_volumes_create.go b/power/models/multi_volumes_create.go index 28ce2b24..61aaa4f4 100644 --- a/power/models/multi_volumes_create.go +++ b/power/models/multi_volumes_create.go @@ -49,8 +49,8 @@ type MultiVolumesCreate struct { // Indicates if the volume should be replication enabled or not ReplicationEnabled *bool `json:"replicationEnabled,omitempty"` - // List of replication sites for volume replication - ReplicationSite []string `json:"replicationSite,omitempty"` + // List of replication site for volume replication + ReplicationSites []string `json:"replicationSites,omitempty"` // Indicates if the volume is shareable between VMs Shareable *bool `json:"shareable,omitempty"` @@ -59,6 +59,9 @@ type MultiVolumesCreate struct { // Required: true Size *int64 `json:"size"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // Volume pool where the volume will be created; if provided then affinityPolicy value will be ignored VolumePool string `json:"volumePool,omitempty"` } @@ -79,6 +82,10 @@ func (m *MultiVolumesCreate) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -145,8 +152,48 @@ func (m *MultiVolumesCreate) validateSize(formats strfmt.Registry) error { return nil } -// ContextValidate validates this multi volumes create based on context it is used +func (m *MultiVolumesCreate) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + +// ContextValidate validate this multi volumes create based on the context it is used func (m *MultiVolumesCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MultiVolumesCreate) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } diff --git a/power/models/network.go b/power/models/network.go index 848f5280..db5ea45e 100644 --- a/power/models/network.go +++ b/power/models/network.go @@ -31,6 +31,9 @@ type Network struct { // (currently not available) cloud connections this network is attached CloudConnections []*NetworkCloudConnectionsItems0 `json:"cloudConnections,omitempty"` + // crn + Crn CRN `json:"crn,omitempty"` + // DHCP Managed Network DhcpManaged bool `json:"dhcpManaged,omitempty"` @@ -73,6 +76,9 @@ type Network struct { // Enum: ["vlan","pub-vlan","dhcp-vlan"] Type *string `json:"type"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // VLAN ID // Required: true VlanID *float64 `json:"vlanID"` @@ -94,6 +100,10 @@ func (m *Network) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateDNSServers(formats); err != nil { res = append(res, err) } @@ -126,6 +136,10 @@ func (m *Network) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if err := m.validateVlanID(formats); err != nil { res = append(res, err) } @@ -188,6 +202,23 @@ func (m *Network) validateCloudConnections(formats strfmt.Registry) error { return nil } +func (m *Network) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *Network) validateDNSServers(formats strfmt.Registry) error { if err := validate.Required("dnsServers", "body", m.DNSServers); err != nil { @@ -350,6 +381,23 @@ func (m *Network) validateType(formats strfmt.Registry) error { return nil } +func (m *Network) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + func (m *Network) validateVlanID(formats strfmt.Registry) error { if err := validate.Required("vlanID", "body", m.VlanID); err != nil { @@ -371,6 +419,10 @@ func (m *Network) ContextValidate(ctx context.Context, formats strfmt.Registry) res = append(res, err) } + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateIPAddressMetrics(ctx, formats); err != nil { res = append(res, err) } @@ -383,6 +435,10 @@ func (m *Network) ContextValidate(ctx context.Context, formats strfmt.Registry) res = append(res, err) } + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -432,6 +488,24 @@ func (m *Network) contextValidateCloudConnections(ctx context.Context, formats s return nil } +func (m *Network) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *Network) contextValidateIPAddressMetrics(ctx context.Context, formats strfmt.Registry) error { if m.IPAddressMetrics != nil { @@ -499,6 +573,20 @@ func (m *Network) contextValidatePublicIPAddressRanges(ctx context.Context, form return nil } +func (m *Network) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *Network) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/network_create.go b/power/models/network_create.go index 093cbaa0..21508e23 100644 --- a/power/models/network_create.go +++ b/power/models/network_create.go @@ -52,6 +52,9 @@ type NetworkCreate struct { // Required: true // Enum: ["vlan","pub-vlan","dhcp-vlan"] Type *string `json:"type"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this network create @@ -74,6 +77,10 @@ func (m *NetworkCreate) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -185,6 +192,23 @@ func (m *NetworkCreate) validateType(formats strfmt.Registry) error { return nil } +func (m *NetworkCreate) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // ContextValidate validate this network create based on the context it is used func (m *NetworkCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -197,6 +221,10 @@ func (m *NetworkCreate) ContextValidate(ctx context.Context, formats strfmt.Regi res = append(res, err) } + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -246,6 +274,20 @@ func (m *NetworkCreate) contextValidateIPAddressRanges(ctx context.Context, form return nil } +func (m *NetworkCreate) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *NetworkCreate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/network_port.go b/power/models/network_port.go index bcd23747..997c0cfa 100644 --- a/power/models/network_port.go +++ b/power/models/network_port.go @@ -208,7 +208,7 @@ type NetworkPortPvmInstance struct { // Link to pvm-instance resource Href string `json:"href,omitempty"` - // The attahed pvm-instance ID + // The attached pvm-instance ID PvmInstanceID string `json:"pvmInstanceID,omitempty"` } diff --git a/power/models/network_port_create.go b/power/models/network_port_create.go index d9c99e85..d3ebbb1b 100644 --- a/power/models/network_port_create.go +++ b/power/models/network_port_create.go @@ -8,6 +8,7 @@ package models import ( "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -22,15 +23,67 @@ type NetworkPortCreate struct { // The requested ip address of this port IPAddress string `json:"ipAddress,omitempty"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this network port create func (m *NetworkPortCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkPortCreate) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } -// ContextValidate validates this network port create based on context it is used +// ContextValidate validate this network port create based on the context it is used func (m *NetworkPortCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkPortCreate) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } diff --git a/power/models/network_reference.go b/power/models/network_reference.go index f4e765c6..a912a1e4 100644 --- a/power/models/network_reference.go +++ b/power/models/network_reference.go @@ -23,6 +23,9 @@ type NetworkReference struct { // access config AccessConfig AccessConfig `json:"accessConfig,omitempty"` + // crn + Crn CRN `json:"crn,omitempty"` + // DHCP Managed Network DhcpManaged bool `json:"dhcpManaged,omitempty"` @@ -64,6 +67,10 @@ func (m *NetworkReference) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateHref(formats); err != nil { res = append(res, err) } @@ -111,6 +118,23 @@ func (m *NetworkReference) validateAccessConfig(formats strfmt.Registry) error { return nil } +func (m *NetworkReference) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *NetworkReference) validateHref(formats strfmt.Registry) error { if err := validate.Required("href", "body", m.Href); err != nil { @@ -217,6 +241,10 @@ func (m *NetworkReference) ContextValidate(ctx context.Context, formats strfmt.R res = append(res, err) } + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -241,6 +269,24 @@ func (m *NetworkReference) contextValidateAccessConfig(ctx context.Context, form return nil } +func (m *NetworkReference) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *NetworkReference) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/p_vm_instance.go b/power/models/p_vm_instance.go index 525c15d6..457affd7 100644 --- a/power/models/p_vm_instance.go +++ b/power/models/p_vm_instance.go @@ -31,6 +31,9 @@ type PVMInstance struct { // Format: date-time CreationDate strfmt.DateTime `json:"creationDate,omitempty"` + // crn + Crn CRN `json:"crn,omitempty"` + // The custom deployment type DeploymentType string `json:"deploymentType,omitempty"` @@ -155,6 +158,9 @@ type PVMInstance struct { // Format: date-time UpdatedDate strfmt.DateTime `json:"updatedDate,omitempty"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // The pvm instance virtual CPU information VirtualCores *VirtualCores `json:"virtualCores,omitempty"` @@ -179,6 +185,10 @@ func (m *PVMInstance) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateDiskSize(formats); err != nil { res = append(res, err) } @@ -251,6 +261,10 @@ func (m *PVMInstance) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if err := m.validateVirtualCores(formats); err != nil { res = append(res, err) } @@ -322,6 +336,23 @@ func (m *PVMInstance) validateCreationDate(formats strfmt.Registry) error { return nil } +func (m *PVMInstance) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *PVMInstance) validateDiskSize(formats strfmt.Registry) error { if err := validate.Required("diskSize", "body", m.DiskSize); err != nil { @@ -605,6 +636,23 @@ func (m *PVMInstance) validateUpdatedDate(formats strfmt.Registry) error { return nil } +func (m *PVMInstance) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + func (m *PVMInstance) validateVirtualCores(formats strfmt.Registry) error { if swag.IsZero(m.VirtualCores) { // not required return nil @@ -645,6 +693,10 @@ func (m *PVMInstance) ContextValidate(ctx context.Context, formats strfmt.Regist res = append(res, err) } + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateFault(ctx, formats); err != nil { res = append(res, err) } @@ -669,6 +721,10 @@ func (m *PVMInstance) ContextValidate(ctx context.Context, formats strfmt.Regist res = append(res, err) } + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateVirtualCores(ctx, formats); err != nil { res = append(res, err) } @@ -725,6 +781,24 @@ func (m *PVMInstance) contextValidateConsoleLanguage(ctx context.Context, format return nil } +func (m *PVMInstance) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *PVMInstance) contextValidateFault(ctx context.Context, formats strfmt.Registry) error { if m.Fault != nil { @@ -863,6 +937,20 @@ func (m *PVMInstance) contextValidateSrcs(ctx context.Context, formats strfmt.Re return nil } +func (m *PVMInstance) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + func (m *PVMInstance) contextValidateVirtualCores(ctx context.Context, formats strfmt.Registry) error { if m.VirtualCores != nil { diff --git a/power/models/p_vm_instance_capture.go b/power/models/p_vm_instance_capture.go index 1f0976d1..1094909f 100644 --- a/power/models/p_vm_instance_capture.go +++ b/power/models/p_vm_instance_capture.go @@ -46,6 +46,9 @@ type PVMInstanceCapture struct { // Cloud Storage Secret key CloudStorageSecretKey string `json:"cloudStorageSecretKey,omitempty"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this p VM instance capture @@ -60,6 +63,10 @@ func (m *PVMInstanceCapture) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -121,8 +128,48 @@ func (m *PVMInstanceCapture) validateCaptureName(formats strfmt.Registry) error return nil } -// ContextValidate validates this p VM instance capture based on context it is used +func (m *PVMInstanceCapture) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + +// ContextValidate validate this p VM instance capture based on the context it is used func (m *PVMInstanceCapture) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceCapture) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } diff --git a/power/models/p_vm_instance_create.go b/power/models/p_vm_instance_create.go index c8ec2702..a44538bb 100644 --- a/power/models/p_vm_instance_create.go +++ b/power/models/p_vm_instance_create.go @@ -21,6 +21,9 @@ import ( // swagger:model PVMInstanceCreate type PVMInstanceCreate struct { + // Indicates if the boot volume should be replication enabled or not + BootVolumeReplicationEnabled *bool `json:"bootVolumeReplicationEnabled,omitempty"` + // The deployment of a dedicated host DeploymentTarget *DeploymentTarget `json:"deploymentTarget,omitempty"` @@ -76,6 +79,9 @@ type PVMInstanceCreate struct { // Number of duplicate instances to create in this request Replicants float64 `json:"replicants,omitempty"` + // Indicates the replication site of the boot volume + ReplicationSites []string `json:"replicationSites"` + // Name of the server to create // Required: true ServerName *string `json:"serverName"` @@ -112,6 +118,9 @@ type PVMInstanceCreate struct { // Cloud init user defined data; For FLS, only cloud-config instance-data is supported and data must not be compressed or exceed 63K UserData string `json:"userData,omitempty"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // The pvm instance virtual CPU information VirtualCores *VirtualCores `json:"virtualCores,omitempty"` @@ -179,6 +188,10 @@ func (m *PVMInstanceCreate) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if err := m.validateVirtualCores(formats); err != nil { res = append(res, err) } @@ -542,6 +555,23 @@ func (m *PVMInstanceCreate) validateStorageConnectionV2(formats strfmt.Registry) return nil } +func (m *PVMInstanceCreate) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + func (m *PVMInstanceCreate) validateVirtualCores(formats strfmt.Registry) error { if swag.IsZero(m.VirtualCores) { // not required return nil @@ -585,6 +615,10 @@ func (m *PVMInstanceCreate) ContextValidate(ctx context.Context, formats strfmt. res = append(res, err) } + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateVirtualCores(ctx, formats); err != nil { res = append(res, err) } @@ -701,6 +735,20 @@ func (m *PVMInstanceCreate) contextValidateStorageAffinity(ctx context.Context, return nil } +func (m *PVMInstanceCreate) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + func (m *PVMInstanceCreate) contextValidateVirtualCores(ctx context.Context, formats strfmt.Registry) error { if m.VirtualCores != nil { diff --git a/power/models/p_vm_instance_reference.go b/power/models/p_vm_instance_reference.go index 54e5d7b1..d15a4159 100644 --- a/power/models/p_vm_instance_reference.go +++ b/power/models/p_vm_instance_reference.go @@ -31,6 +31,9 @@ type PVMInstanceReference struct { // Format: date-time CreationDate strfmt.DateTime `json:"creationDate,omitempty"` + // crn + Crn CRN `json:"crn,omitempty"` + // Size of allocated disk (in GB) // Required: true DiskSize *float64 `json:"diskSize"` @@ -168,6 +171,10 @@ func (m *PVMInstanceReference) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateDiskSize(formats); err != nil { res = append(res, err) } @@ -303,6 +310,23 @@ func (m *PVMInstanceReference) validateCreationDate(formats strfmt.Registry) err return nil } +func (m *PVMInstanceReference) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *PVMInstanceReference) validateDiskSize(formats strfmt.Registry) error { if err := validate.Required("diskSize", "body", m.DiskSize); err != nil { @@ -605,6 +629,10 @@ func (m *PVMInstanceReference) ContextValidate(ctx context.Context, formats strf res = append(res, err) } + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateFault(ctx, formats); err != nil { res = append(res, err) } @@ -685,6 +713,24 @@ func (m *PVMInstanceReference) contextValidateConsoleLanguage(ctx context.Contex return nil } +func (m *PVMInstanceReference) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *PVMInstanceReference) contextValidateFault(ctx context.Context, formats strfmt.Registry) error { if m.Fault != nil { diff --git a/power/models/p_vm_instance_reference_v2.go b/power/models/p_vm_instance_reference_v2.go index 4fcc6864..929e93a8 100644 --- a/power/models/p_vm_instance_reference_v2.go +++ b/power/models/p_vm_instance_reference_v2.go @@ -31,6 +31,9 @@ type PVMInstanceReferenceV2 struct { // Format: date-time CreationDate strfmt.DateTime `json:"creationDate,omitempty"` + // crn + Crn CRN `json:"crn,omitempty"` + // The pvm instance deployment information // Required: true Deployment *PvmInstanceDeployment `json:"deployment"` @@ -92,6 +95,10 @@ func (m *PVMInstanceReferenceV2) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateDeployment(formats); err != nil { res = append(res, err) } @@ -197,6 +204,23 @@ func (m *PVMInstanceReferenceV2) validateCreationDate(formats strfmt.Registry) e return nil } +func (m *PVMInstanceReferenceV2) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *PVMInstanceReferenceV2) validateDeployment(formats strfmt.Registry) error { if err := validate.Required("deployment", "body", m.Deployment); err != nil { @@ -408,6 +432,10 @@ func (m *PVMInstanceReferenceV2) ContextValidate(ctx context.Context, formats st res = append(res, err) } + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateDeployment(ctx, formats); err != nil { res = append(res, err) } @@ -484,6 +512,24 @@ func (m *PVMInstanceReferenceV2) contextValidateCores(ctx context.Context, forma return nil } +func (m *PVMInstanceReferenceV2) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *PVMInstanceReferenceV2) contextValidateDeployment(ctx context.Context, formats strfmt.Registry) error { if m.Deployment != nil { diff --git a/power/models/p_vm_instance_update_response.go b/power/models/p_vm_instance_update_response.go index 21176e39..4a373de2 100644 --- a/power/models/p_vm_instance_update_response.go +++ b/power/models/p_vm_instance_update_response.go @@ -36,7 +36,7 @@ type PVMInstanceUpdateResponse struct { // Number of processors allocated Processors float64 `json:"processors,omitempty"` - // Name of the server to create + // Name of the server ServerName string `json:"serverName,omitempty"` // URL to check for status of the operation (for now, just the URL for the GET on the server, which has status information from powervc) diff --git a/power/models/replication_service.go b/power/models/replication_service.go new file mode 100644 index 00000000..c16beb90 --- /dev/null +++ b/power/models/replication_service.go @@ -0,0 +1,141 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ReplicationService replication service +// +// swagger:model ReplicationService +type ReplicationService struct { + + // Service Enabled + // Required: true + Enabled *bool `json:"enabled"` + + // List of all replication targets + // Required: true + TargetLocations []*ReplicationTargetLocation `json:"targetLocations"` +} + +// Validate validates this replication service +func (m *ReplicationService) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEnabled(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTargetLocations(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ReplicationService) validateEnabled(formats strfmt.Registry) error { + + if err := validate.Required("enabled", "body", m.Enabled); err != nil { + return err + } + + return nil +} + +func (m *ReplicationService) validateTargetLocations(formats strfmt.Registry) error { + + if err := validate.Required("targetLocations", "body", m.TargetLocations); err != nil { + return err + } + + for i := 0; i < len(m.TargetLocations); i++ { + if swag.IsZero(m.TargetLocations[i]) { // not required + continue + } + + if m.TargetLocations[i] != nil { + if err := m.TargetLocations[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("targetLocations" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("targetLocations" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this replication service based on the context it is used +func (m *ReplicationService) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTargetLocations(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ReplicationService) contextValidateTargetLocations(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TargetLocations); i++ { + + if m.TargetLocations[i] != nil { + + if swag.IsZero(m.TargetLocations[i]) { // not required + return nil + } + + if err := m.TargetLocations[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("targetLocations" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("targetLocations" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ReplicationService) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ReplicationService) UnmarshalBinary(b []byte) error { + var res ReplicationService + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/replication_target_location.go b/power/models/replication_target_location.go new file mode 100644 index 00000000..453edf48 --- /dev/null +++ b/power/models/replication_target_location.go @@ -0,0 +1,108 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ReplicationTargetLocation replication target location +// +// swagger:model ReplicationTargetLocation +type ReplicationTargetLocation struct { + + // regionZone of replication site + Region string `json:"region,omitempty"` + + // the replication site is active / down + // Enum: ["active","down"] + Status string `json:"status,omitempty"` +} + +// Validate validates this replication target location +func (m *ReplicationTargetLocation) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var replicationTargetLocationTypeStatusPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["active","down"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + replicationTargetLocationTypeStatusPropEnum = append(replicationTargetLocationTypeStatusPropEnum, v) + } +} + +const ( + + // ReplicationTargetLocationStatusActive captures enum value "active" + ReplicationTargetLocationStatusActive string = "active" + + // ReplicationTargetLocationStatusDown captures enum value "down" + ReplicationTargetLocationStatusDown string = "down" +) + +// prop value enum +func (m *ReplicationTargetLocation) validateStatusEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, replicationTargetLocationTypeStatusPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *ReplicationTargetLocation) validateStatus(formats strfmt.Registry) error { + if swag.IsZero(m.Status) { // not required + return nil + } + + // value enum + if err := m.validateStatusEnum("status", "body", m.Status); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this replication target location based on context it is used +func (m *ReplicationTargetLocation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ReplicationTargetLocation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ReplicationTargetLocation) UnmarshalBinary(b []byte) error { + var res ReplicationTargetLocation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/s_a_p_create.go b/power/models/s_a_p_create.go index 36187301..830973ef 100644 --- a/power/models/s_a_p_create.go +++ b/power/models/s_a_p_create.go @@ -20,6 +20,9 @@ import ( // swagger:model SAPCreate type SAPCreate struct { + // Indicates if the boot volume should be replication enabled or not + BootVolumeReplicationEnabled *bool `json:"bootVolumeReplicationEnabled,omitempty"` + // The deployment of a dedicated host DeploymentTarget *DeploymentTarget `json:"deploymentTarget,omitempty"` @@ -51,6 +54,9 @@ type SAPCreate struct { // Required: true ProfileID *string `json:"profileID"` + // Indicates the replication site of the boot volume + ReplicationSites []string `json:"replicationSites"` + // The name of the SSH Key to provide to the server for authenticating SSHKeyName string `json:"sshKeyName,omitempty"` @@ -69,6 +75,9 @@ type SAPCreate struct { // Cloud init user defined data; For FLS, only cloud-config instance-data is supported and data must not be compressed or exceed 63K UserData string `json:"userData,omitempty"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // List of Volume IDs to attach to the pvm-instance on creation VolumeIDs []string `json:"volumeIDs"` } @@ -109,6 +118,10 @@ func (m *SAPCreate) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -243,6 +256,23 @@ func (m *SAPCreate) validateStorageAffinity(formats strfmt.Registry) error { return nil } +func (m *SAPCreate) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // ContextValidate validate this s a p create based on the context it is used func (m *SAPCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -267,6 +297,10 @@ func (m *SAPCreate) ContextValidate(ctx context.Context, formats strfmt.Registry res = append(res, err) } + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -379,6 +413,20 @@ func (m *SAPCreate) contextValidateStorageAffinity(ctx context.Context, formats return nil } +func (m *SAPCreate) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *SAPCreate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/shared_processor_pool.go b/power/models/shared_processor_pool.go index 6cd9a57f..2a627441 100644 --- a/power/models/shared_processor_pool.go +++ b/power/models/shared_processor_pool.go @@ -28,6 +28,9 @@ type SharedProcessorPool struct { // Required: true AvailableCores *float64 `json:"availableCores"` + // crn + Crn CRN `json:"crn,omitempty"` + // The host group the host belongs to HostGroup string `json:"hostGroup,omitempty"` @@ -54,6 +57,9 @@ type SharedProcessorPool struct { // The status details of the Shared Processor Pool StatusDetail string `json:"statusDetail,omitempty"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this shared processor pool @@ -68,6 +74,10 @@ func (m *SharedProcessorPool) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateID(formats); err != nil { res = append(res, err) } @@ -84,6 +94,10 @@ func (m *SharedProcessorPool) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -108,6 +122,23 @@ func (m *SharedProcessorPool) validateAvailableCores(formats strfmt.Registry) er return nil } +func (m *SharedProcessorPool) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *SharedProcessorPool) validateID(formats strfmt.Registry) error { if err := validate.Required("id", "body", m.ID); err != nil { @@ -161,20 +192,63 @@ func (m *SharedProcessorPool) validateSharedProcessorPoolPlacementGroups(formats return nil } +func (m *SharedProcessorPool) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // ContextValidate validate this shared processor pool based on the context it is used func (m *SharedProcessorPool) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateSharedProcessorPoolPlacementGroups(ctx, formats); err != nil { res = append(res, err) } + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } +func (m *SharedProcessorPool) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *SharedProcessorPool) contextValidateSharedProcessorPoolPlacementGroups(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.SharedProcessorPoolPlacementGroups); i++ { @@ -200,6 +274,20 @@ func (m *SharedProcessorPool) contextValidateSharedProcessorPoolPlacementGroups( return nil } +func (m *SharedProcessorPool) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *SharedProcessorPool) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/shared_processor_pool_create.go b/power/models/shared_processor_pool_create.go index a951586a..95eaf671 100644 --- a/power/models/shared_processor_pool_create.go +++ b/power/models/shared_processor_pool_create.go @@ -36,6 +36,9 @@ type SharedProcessorPoolCreate struct { // The amount of reserved processor cores for the Shared Processor Pool; only integers allowed, no fractional values // Required: true ReservedCores *int64 `json:"reservedCores"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this shared processor pool create @@ -54,6 +57,10 @@ func (m *SharedProcessorPoolCreate) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -87,8 +94,48 @@ func (m *SharedProcessorPoolCreate) validateReservedCores(formats strfmt.Registr return nil } -// ContextValidate validates this shared processor pool create based on context it is used +func (m *SharedProcessorPoolCreate) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + +// ContextValidate validate this shared processor pool create based on the context it is used func (m *SharedProcessorPoolCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SharedProcessorPoolCreate) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } diff --git a/power/models/snapshot.go b/power/models/snapshot.go index c5d2fc31..3d7319f7 100644 --- a/power/models/snapshot.go +++ b/power/models/snapshot.go @@ -26,6 +26,9 @@ type Snapshot struct { // Format: date-time CreationDate strfmt.DateTime `json:"creationDate,omitempty"` + // crn + Crn CRN `json:"crn,omitempty"` + // Description of the PVM instance snapshot Description string `json:"description,omitempty"` @@ -64,6 +67,10 @@ func (m *Snapshot) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateLastUpdateDate(formats); err != nil { res = append(res, err) } @@ -102,6 +109,23 @@ func (m *Snapshot) validateCreationDate(formats strfmt.Registry) error { return nil } +func (m *Snapshot) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *Snapshot) validateLastUpdateDate(formats strfmt.Registry) error { if swag.IsZero(m.LastUpdateDate) { // not required return nil @@ -150,8 +174,35 @@ func (m *Snapshot) validateVolumeSnapshots(formats strfmt.Registry) error { return nil } -// ContextValidate validates this snapshot based on context it is used +// ContextValidate validate this snapshot based on the context it is used func (m *Snapshot) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Snapshot) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + return nil } diff --git a/power/models/snapshot_create.go b/power/models/snapshot_create.go index 00377110..8d85520a 100644 --- a/power/models/snapshot_create.go +++ b/power/models/snapshot_create.go @@ -26,6 +26,9 @@ type SnapshotCreate struct { // Required: true Name *string `json:"name"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // List of volumes to include in the PVM instance snapshot VolumeIDs []string `json:"volumeIDs"` } @@ -38,6 +41,10 @@ func (m *SnapshotCreate) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -53,8 +60,48 @@ func (m *SnapshotCreate) validateName(formats strfmt.Registry) error { return nil } -// ContextValidate validates this snapshot create based on context it is used +func (m *SnapshotCreate) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + +// ContextValidate validate this snapshot create based on the context it is used func (m *SnapshotCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SnapshotCreate) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } diff --git a/power/models/snapshot_create_response.go b/power/models/snapshot_create_response.go index 61214fb3..eda2822b 100644 --- a/power/models/snapshot_create_response.go +++ b/power/models/snapshot_create_response.go @@ -19,25 +19,56 @@ import ( // swagger:model SnapshotCreateResponse type SnapshotCreateResponse struct { + // crn + Crn CRN `json:"crn,omitempty"` + // ID of the PVM instance snapshot // Required: true SnapshotID *string `json:"snapshotID"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this snapshot create response func (m *SnapshotCreateResponse) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateSnapshotID(formats); err != nil { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } +func (m *SnapshotCreateResponse) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *SnapshotCreateResponse) validateSnapshotID(formats strfmt.Registry) error { if err := validate.Required("snapshotID", "body", m.SnapshotID); err != nil { @@ -47,8 +78,70 @@ func (m *SnapshotCreateResponse) validateSnapshotID(formats strfmt.Registry) err return nil } -// ContextValidate validates this snapshot create response based on context it is used +func (m *SnapshotCreateResponse) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + +// ContextValidate validate this snapshot create response based on the context it is used func (m *SnapshotCreateResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SnapshotCreateResponse) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + +func (m *SnapshotCreateResponse) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } diff --git a/power/models/snapshot_list.go b/power/models/snapshot_list.go index a1e6fd10..ee6a7d7b 100644 --- a/power/models/snapshot_list.go +++ b/power/models/snapshot_list.go @@ -20,7 +20,7 @@ import ( // swagger:model SnapshotList type SnapshotList struct { - // The list of snapshots. + // The list of volume snapshots. // Required: true Snapshots []*SnapshotV1 `json:"snapshots"` } diff --git a/power/models/snapshot_v1.go b/power/models/snapshot_v1.go index 2974fef6..570c3a4f 100644 --- a/power/models/snapshot_v1.go +++ b/power/models/snapshot_v1.go @@ -19,27 +19,30 @@ import ( // swagger:model SnapshotV1 type SnapshotV1 struct { - // The date and time when the snapshot was created. + // The date and time when the volume snapshot was created. // Format: date-time CreationDate strfmt.DateTime `json:"creationDate,omitempty"` - // The snapshot UUID. + // crn + Crn CRN `json:"crn,omitempty"` + + // The volume snapshot UUID. // Required: true ID *string `json:"id"` - // The snapshot name. + // The volume snapshot name. // Required: true Name *string `json:"name"` - // The size of the snapshot, in gibibytes (GiB). + // The size of the volume snapshot, in gibibytes (GiB). // Required: true Size *float64 `json:"size"` - // The status for the snapshot. + // The status for the volume snapshot. // Required: true Status *string `json:"status"` - // The date and time when the snapshot was last updated. + // The date and time when the volume snapshot was last updated. // Format: date-time UpdatedDate strfmt.DateTime `json:"updatedDate,omitempty"` @@ -56,6 +59,10 @@ func (m *SnapshotV1) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateID(formats); err != nil { res = append(res, err) } @@ -98,6 +105,23 @@ func (m *SnapshotV1) validateCreationDate(formats strfmt.Registry) error { return nil } +func (m *SnapshotV1) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *SnapshotV1) validateID(formats strfmt.Registry) error { if err := validate.Required("id", "body", m.ID); err != nil { @@ -155,8 +179,35 @@ func (m *SnapshotV1) validateVolumeID(formats strfmt.Registry) error { return nil } -// ContextValidate validates this snapshot v1 based on context it is used +// ContextValidate validate this snapshot v1 based on the context it is used func (m *SnapshotV1) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SnapshotV1) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + return nil } diff --git a/power/models/supported_systems.go b/power/models/supported_systems.go new file mode 100644 index 00000000..de991f0f --- /dev/null +++ b/power/models/supported_systems.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" +) + +// SupportedSystems supported systems +// +// swagger:model SupportedSystems +type SupportedSystems struct { + + // List of all available dedicated host types + // Required: true + Dedicated []string `json:"dedicated"` + + // List of all available host types + // Required: true + General []string `json:"general"` +} + +// Validate validates this supported systems +func (m *SupportedSystems) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDedicated(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGeneral(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SupportedSystems) validateDedicated(formats strfmt.Registry) error { + + if err := validate.Required("dedicated", "body", m.Dedicated); err != nil { + return err + } + + return nil +} + +func (m *SupportedSystems) validateGeneral(formats strfmt.Registry) error { + + if err := validate.Required("general", "body", m.General); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this supported systems based on context it is used +func (m *SupportedSystems) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SupportedSystems) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SupportedSystems) UnmarshalBinary(b []byte) error { + var res SupportedSystems + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/system_pool.go b/power/models/system_pool.go index fc5ed175..42d0c350 100644 --- a/power/models/system_pool.go +++ b/power/models/system_pool.go @@ -22,6 +22,9 @@ type SystemPool struct { // Advertised capacity cores and memory (GB) Capacity *System `json:"capacity,omitempty"` + // Core allocation increment + CoreIncrement float64 `json:"coreIncrement,omitempty"` + // Processor to Memory (GB) Ratio CoreMemoryRatio float64 `json:"coreMemoryRatio,omitempty"` diff --git a/power/models/tags.go b/power/models/tags.go new file mode 100644 index 00000000..477c7687 --- /dev/null +++ b/power/models/tags.go @@ -0,0 +1,27 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" +) + +// Tags List of user tags +// +// swagger:model Tags +type Tags []string + +// Validate validates this tags +func (m Tags) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this tags based on context it is used +func (m Tags) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/power/models/volume.go b/power/models/volume.go index 97e5ca8b..5394c368 100644 --- a/power/models/volume.go +++ b/power/models/volume.go @@ -26,7 +26,7 @@ type Volume struct { // true if volume is auxiliary otherwise false Auxiliary *bool `json:"auxiliary,omitempty"` - // Indicates if the volume is the server's boot volume + // Indicates if the volume is the server's boot volume. Only returned when querying a server's attached volumes BootVolume *bool `json:"bootVolume,omitempty"` // Indicates if the volume is boot capable @@ -40,12 +40,19 @@ type Volume struct { // Format: date-time CreationDate *strfmt.DateTime `json:"creationDate"` + // crn + Crn CRN `json:"crn,omitempty"` + // Indicates if the volume should be deleted when the server terminates DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` // Type of Disk DiskType string `json:"diskType,omitempty"` + // Freeze time of remote copy relationship + // Format: date-time + FreezeTime *strfmt.DateTime `json:"freezeTime,omitempty"` + // Volume Group ID GroupID string `json:"groupID,omitempty"` @@ -80,8 +87,8 @@ type Volume struct { // True if volume is replication enabled otherwise false ReplicationEnabled *bool `json:"replicationEnabled,omitempty"` - // List of replication sites for volume replication - ReplicationSite []string `json:"replicationSite,omitempty"` + // List of replication site for volume replication + ReplicationSites []string `json:"replicationSites,omitempty"` // Replication status of a volume ReplicationStatus string `json:"replicationStatus,omitempty"` @@ -99,6 +106,9 @@ type Volume struct { // Volume State State string `json:"state,omitempty"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // Volume ID // Required: true VolumeID *string `json:"volumeID"` @@ -121,6 +131,14 @@ func (m *Volume) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFreezeTime(formats); err != nil { + res = append(res, err) + } + if err := m.validateLastUpdateDate(formats); err != nil { res = append(res, err) } @@ -137,6 +155,10 @@ func (m *Volume) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if err := m.validateVolumeID(formats); err != nil { res = append(res, err) } @@ -160,6 +182,35 @@ func (m *Volume) validateCreationDate(formats strfmt.Registry) error { return nil } +func (m *Volume) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + +func (m *Volume) validateFreezeTime(formats strfmt.Registry) error { + if swag.IsZero(m.FreezeTime) { // not required + return nil + } + + if err := validate.FormatOf("freezeTime", "body", "date-time", m.FreezeTime.String(), formats); err != nil { + return err + } + + return nil +} + func (m *Volume) validateLastUpdateDate(formats strfmt.Registry) error { if err := validate.Required("lastUpdateDate", "body", m.LastUpdateDate); err != nil { @@ -233,6 +284,23 @@ func (m *Volume) validateSize(formats strfmt.Registry) error { return nil } +func (m *Volume) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + func (m *Volume) validateVolumeID(formats strfmt.Registry) error { if err := validate.Required("volumeID", "body", m.VolumeID); err != nil { @@ -242,8 +310,53 @@ func (m *Volume) validateVolumeID(formats strfmt.Registry) error { return nil } -// ContextValidate validates this volume based on context it is used +// ContextValidate validate this volume based on the context it is used func (m *Volume) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Volume) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + +func (m *Volume) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } diff --git a/power/models/volume_group.go b/power/models/volume_group.go index 077a3dbd..77e8f9dc 100644 --- a/power/models/volume_group.go +++ b/power/models/volume_group.go @@ -19,6 +19,9 @@ import ( // swagger:model VolumeGroup type VolumeGroup struct { + // Indicates whether the volume group is for auxiliary volumes or master volumes + Auxiliary *bool `json:"auxiliary,omitempty"` + // The name of consistencyGroup at storage host level ConsistencyGroupName string `json:"consistencyGroupName,omitempty"` @@ -30,6 +33,9 @@ type VolumeGroup struct { // Required: true Name *string `json:"name"` + // Indicates the replication site of the volume group + ReplicationSites []string `json:"replicationSites"` + // Replication status of volume group ReplicationStatus string `json:"replicationStatus,omitempty"` @@ -38,6 +44,9 @@ type VolumeGroup struct { // Status details of the volume group StatusDescription *StatusDescription `json:"statusDescription,omitempty"` + + // Indicates the storage pool of the volume group + StoragePool string `json:"storagePool,omitempty"` } // Validate validates this volume group diff --git a/power/models/volume_group_details.go b/power/models/volume_group_details.go index 2642a06d..fb9a4edf 100644 --- a/power/models/volume_group_details.go +++ b/power/models/volume_group_details.go @@ -19,6 +19,9 @@ import ( // swagger:model VolumeGroupDetails type VolumeGroupDetails struct { + // Indicates whether the volume group is for auxiliary volumes or master volumes + Auxiliary *bool `json:"auxiliary,omitempty"` + // The name of volume group at storage host level ConsistencyGroupName string `json:"consistencyGroupName,omitempty"` @@ -30,6 +33,9 @@ type VolumeGroupDetails struct { // Required: true Name *string `json:"name"` + // Indicates the replication site of the volume group + ReplicationSites []string `json:"replicationSites"` + // Replication status of volume group ReplicationStatus string `json:"replicationStatus,omitempty"` @@ -39,6 +45,9 @@ type VolumeGroupDetails struct { // Status details of the volume group StatusDescription *StatusDescription `json:"statusDescription,omitempty"` + // Indicates the storage pool of the volume group + StoragePool string `json:"storagePool,omitempty"` + // List of volume IDs,member of VolumeGroup VolumeIDs []string `json:"volumeIDs"` } diff --git a/power/models/volume_info.go b/power/models/volume_info.go index 26f5b3f2..59905e25 100644 --- a/power/models/volume_info.go +++ b/power/models/volume_info.go @@ -8,6 +8,7 @@ package models import ( "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -17,6 +18,9 @@ import ( // swagger:model VolumeInfo type VolumeInfo struct { + // crn + Crn CRN `json:"crn,omitempty"` + // Name of the volume Name string `json:"name,omitempty"` @@ -26,11 +30,64 @@ type VolumeInfo struct { // Validate validates this volume info func (m *VolumeInfo) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumeInfo) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + return nil } -// ContextValidate validates this volume info based on context it is used +// ContextValidate validate this volume info based on the context it is used func (m *VolumeInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumeInfo) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + return nil } diff --git a/power/models/volume_reference.go b/power/models/volume_reference.go index 1998307a..037c3b43 100644 --- a/power/models/volume_reference.go +++ b/power/models/volume_reference.go @@ -26,7 +26,7 @@ type VolumeReference struct { // true if volume is auxiliary otherwise false Auxiliary *bool `json:"auxiliary,omitempty"` - // Indicates if the volume is the server's boot volume + // Indicates if the volume is the server's boot volume. Only returned when querying a server's attached volumes BootVolume *bool `json:"bootVolume,omitempty"` // Indicates if the volume is boot capable @@ -41,6 +41,9 @@ type VolumeReference struct { // Format: date-time CreationDate *strfmt.DateTime `json:"creationDate"` + // crn + Crn CRN `json:"crn,omitempty"` + // Indicates if the volume should be deleted when the server terminates DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` @@ -48,6 +51,10 @@ type VolumeReference struct { // Required: true DiskType *string `json:"diskType"` + // Freeze time of remote copy relationship + // Format: date-time + FreezeTime *strfmt.DateTime `json:"freezeTime,omitempty"` + // Volume Group ID GroupID string `json:"groupID,omitempty"` @@ -86,8 +93,8 @@ type VolumeReference struct { // True if volume is replication enabled otherwise false ReplicationEnabled *bool `json:"replicationEnabled,omitempty"` - // List of replication sites for volume replication - ReplicationSite []string `json:"replicationSite,omitempty"` + // List of replication site for volume replication + ReplicationSites []string `json:"replicationSites,omitempty"` // shows the replication status of a volume ReplicationStatus string `json:"replicationStatus,omitempty"` @@ -107,6 +114,9 @@ type VolumeReference struct { // Required: true State *string `json:"state"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // Volume ID // Required: true VolumeID *string `json:"volumeID"` @@ -134,10 +144,18 @@ func (m *VolumeReference) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + if err := m.validateDiskType(formats); err != nil { res = append(res, err) } + if err := m.validateFreezeTime(formats); err != nil { + res = append(res, err) + } + if err := m.validateHref(formats); err != nil { res = append(res, err) } @@ -166,6 +184,10 @@ func (m *VolumeReference) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if err := m.validateVolumeID(formats); err != nil { res = append(res, err) } @@ -202,6 +224,23 @@ func (m *VolumeReference) validateCreationDate(formats strfmt.Registry) error { return nil } +func (m *VolumeReference) validateCrn(formats strfmt.Registry) error { + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + func (m *VolumeReference) validateDiskType(formats strfmt.Registry) error { if err := validate.Required("diskType", "body", m.DiskType); err != nil { @@ -211,6 +250,18 @@ func (m *VolumeReference) validateDiskType(formats strfmt.Registry) error { return nil } +func (m *VolumeReference) validateFreezeTime(formats strfmt.Registry) error { + if swag.IsZero(m.FreezeTime) { // not required + return nil + } + + if err := validate.FormatOf("freezeTime", "body", "date-time", m.FreezeTime.String(), formats); err != nil { + return err + } + + return nil +} + func (m *VolumeReference) validateHref(formats strfmt.Registry) error { if err := validate.Required("href", "body", m.Href); err != nil { @@ -311,6 +362,23 @@ func (m *VolumeReference) validateState(formats strfmt.Registry) error { return nil } +func (m *VolumeReference) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + func (m *VolumeReference) validateVolumeID(formats strfmt.Registry) error { if err := validate.Required("volumeID", "body", m.VolumeID); err != nil { @@ -329,8 +397,53 @@ func (m *VolumeReference) validateWwn(formats strfmt.Registry) error { return nil } -// ContextValidate validates this volume reference based on context it is used +// ContextValidate validate this volume reference based on the context it is used func (m *VolumeReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCrn(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumeReference) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Crn) { // not required + return nil + } + + if err := m.Crn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("crn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("crn") + } + return err + } + + return nil +} + +func (m *VolumeReference) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } diff --git a/power/models/volume_snapshot_list.go b/power/models/volume_snapshot_list.go new file mode 100644 index 00000000..9190cd33 --- /dev/null +++ b/power/models/volume_snapshot_list.go @@ -0,0 +1,121 @@ +// 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" +) + +// VolumeSnapshotList volume snapshot list +// +// swagger:model VolumeSnapshotList +type VolumeSnapshotList struct { + + // The list of volume snapshots. + VolumeSnapshots []*SnapshotV1 `json:"volumeSnapshots"` +} + +// Validate validates this volume snapshot list +func (m *VolumeSnapshotList) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVolumeSnapshots(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumeSnapshotList) validateVolumeSnapshots(formats strfmt.Registry) error { + if swag.IsZero(m.VolumeSnapshots) { // not required + return nil + } + + for i := 0; i < len(m.VolumeSnapshots); i++ { + if swag.IsZero(m.VolumeSnapshots[i]) { // not required + continue + } + + if m.VolumeSnapshots[i] != nil { + if err := m.VolumeSnapshots[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("volumeSnapshots" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volumeSnapshots" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this volume snapshot list based on the context it is used +func (m *VolumeSnapshotList) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVolumeSnapshots(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumeSnapshotList) contextValidateVolumeSnapshots(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.VolumeSnapshots); i++ { + + if m.VolumeSnapshots[i] != nil { + + if swag.IsZero(m.VolumeSnapshots[i]) { // not required + return nil + } + + if err := m.VolumeSnapshots[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("volumeSnapshots" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volumeSnapshots" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *VolumeSnapshotList) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VolumeSnapshotList) UnmarshalBinary(b []byte) error { + var res VolumeSnapshotList + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/volumes_clone_async_request.go b/power/models/volumes_clone_async_request.go index 1b0993a1..6d9f8c3b 100644 --- a/power/models/volumes_clone_async_request.go +++ b/power/models/volumes_clone_async_request.go @@ -40,6 +40,9 @@ type VolumesCloneAsyncRequest struct { // TargetStorageTier string `json:"targetStorageTier,omitempty"` + // user tags + UserTags Tags `json:"userTags,omitempty"` + // List of volumes to be cloned // Required: true VolumeIDs []string `json:"volumeIDs"` @@ -53,6 +56,10 @@ func (m *VolumesCloneAsyncRequest) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if err := m.validateVolumeIDs(formats); err != nil { res = append(res, err) } @@ -72,6 +79,23 @@ func (m *VolumesCloneAsyncRequest) validateName(formats strfmt.Registry) error { return nil } +func (m *VolumesCloneAsyncRequest) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + func (m *VolumesCloneAsyncRequest) validateVolumeIDs(formats strfmt.Registry) error { if err := validate.Required("volumeIDs", "body", m.VolumeIDs); err != nil { @@ -81,8 +105,31 @@ func (m *VolumesCloneAsyncRequest) validateVolumeIDs(formats strfmt.Registry) er return nil } -// ContextValidate validates this volumes clone async request based on context it is used +// ContextValidate validate this volumes clone async request based on the context it is used func (m *VolumesCloneAsyncRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumesCloneAsyncRequest) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } diff --git a/power/models/volumes_clone_execute.go b/power/models/volumes_clone_execute.go index b470cb78..e118ea23 100644 --- a/power/models/volumes_clone_execute.go +++ b/power/models/volumes_clone_execute.go @@ -44,6 +44,9 @@ type VolumesCloneExecute struct { // the source volumes. // TargetStorageTier string `json:"targetStorageTier,omitempty"` + + // user tags + UserTags Tags `json:"userTags,omitempty"` } // Validate validates this volumes clone execute @@ -54,6 +57,10 @@ func (m *VolumesCloneExecute) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUserTags(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -69,8 +76,48 @@ func (m *VolumesCloneExecute) validateName(formats strfmt.Registry) error { return nil } -// ContextValidate validates this volumes clone execute based on context it is used +func (m *VolumesCloneExecute) validateUserTags(formats strfmt.Registry) error { + if swag.IsZero(m.UserTags) { // not required + return nil + } + + if err := m.UserTags.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + + return nil +} + +// ContextValidate validate this volumes clone execute based on the context it is used func (m *VolumesCloneExecute) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUserTags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumesCloneExecute) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { + + if err := m.UserTags.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("userTags") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("userTags") + } + return err + } + return nil } From d4bae350fd71a6aa9be6496c0a46317a9ec98ef0 Mon Sep 17 00:00:00 2001 From: ismirlia <90468712+ismirlia@users.noreply.github.com> Date: Wed, 11 Sep 2024 15:33:55 -0500 Subject: [PATCH 006/123] Reenable bulk-detach and bulk-delete for Q3 (#460) --- clients/instance/ibm-pi-volume.go | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/clients/instance/ibm-pi-volume.go b/clients/instance/ibm-pi-volume.go index e5a628ba..a05849c3 100644 --- a/clients/instance/ibm-pi-volume.go +++ b/clients/instance/ibm-pi-volume.go @@ -257,12 +257,34 @@ func (f *IBMPIVolumeClient) GetVolumeFlashCopyMappings(id string) (models.FlashC // Bulk volume detach func (f *IBMPIVolumeClient) BulkVolumeDetach(pvmID string, body *models.VolumesDetach) (*models.VolumesDetachmentResponse, error) { - return nil, fmt.Errorf("operation not supported") + params := p_cloud_volumes.NewPcloudV2PvminstancesVolumesDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut).WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(pvmID). + WithBody(body) + resp, err := f.session.Power.PCloudVolumes.PcloudV2PvminstancesVolumesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf(errors.DetachVolumesOperationFailed, pvmID, f.cloudInstanceID, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed detaching volumes for %s", pvmID) + } + return resp.Payload, nil } // Bulk volume delete func (f *IBMPIVolumeClient) BulkVolumeDelete(body *models.VolumesDelete) (*models.VolumesDeleteResponse, error) { - return nil, fmt.Errorf("operation not supported") + params := p_cloud_volumes.NewPcloudV2VolumesDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithBody(body) + respOk, respPartial, err := f.session.Power.PCloudVolumes.PcloudV2VolumesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf(errors.DeleteVolumeOperationFailed, body.VolumeIDs, err)) + } + if respOk != nil && respOk.Payload != nil { + return respOk.Payload, nil + } + if respPartial != nil && respPartial.Payload != nil { + return respPartial.Payload, nil + } + return nil, fmt.Errorf("failed Deleting volumes : %s", body.VolumeIDs) } // Bulk volutme attach From 3d21f551755d0f7a3856fc5738c2666be1b27daa Mon Sep 17 00:00:00 2001 From: ismirlia <90468712+ismirlia@users.noreply.github.com> Date: Mon, 16 Sep 2024 12:26:24 -0500 Subject: [PATCH 007/123] Add network-interfaces for Q3 (#464) --- clients/instance/ibm-pi-network.go | 63 ++ power/client/networks/networks_client.go | 270 ++++++++ ...ks_network_interfaces_delete_parameters.go | 173 +++++ ...rks_network_interfaces_delete_responses.go | 560 +++++++++++++++ ...works_network_interfaces_get_parameters.go | 173 +++++ ...tworks_network_interfaces_get_responses.go | 486 +++++++++++++ ...ks_network_interfaces_getall_parameters.go | 151 +++++ ...rks_network_interfaces_getall_responses.go | 486 +++++++++++++ ...orks_network_interfaces_post_parameters.go | 175 +++++ ...works_network_interfaces_post_responses.go | 638 ++++++++++++++++++ ...works_network_interfaces_put_parameters.go | 197 ++++++ ...tworks_network_interfaces_put_responses.go | 562 +++++++++++++++ power/client/power_iaas_api_client.go | 5 + power/models/network_interface.go | 258 +++++++ power/models/network_interface_create.go | 56 ++ power/models/network_interface_update.go | 53 ++ power/models/network_interfaces.go | 124 ++++ 17 files changed, 4430 insertions(+) create mode 100644 power/client/networks/networks_client.go create mode 100644 power/client/networks/v1_networks_network_interfaces_delete_parameters.go create mode 100644 power/client/networks/v1_networks_network_interfaces_delete_responses.go create mode 100644 power/client/networks/v1_networks_network_interfaces_get_parameters.go create mode 100644 power/client/networks/v1_networks_network_interfaces_get_responses.go create mode 100644 power/client/networks/v1_networks_network_interfaces_getall_parameters.go create mode 100644 power/client/networks/v1_networks_network_interfaces_getall_responses.go create mode 100644 power/client/networks/v1_networks_network_interfaces_post_parameters.go create mode 100644 power/client/networks/v1_networks_network_interfaces_post_responses.go create mode 100644 power/client/networks/v1_networks_network_interfaces_put_parameters.go create mode 100644 power/client/networks/v1_networks_network_interfaces_put_responses.go create mode 100644 power/models/network_interface.go create mode 100644 power/models/network_interface_create.go create mode 100644 power/models/network_interface_update.go create mode 100644 power/models/network_interfaces.go diff --git a/clients/instance/ibm-pi-network.go b/clients/instance/ibm-pi-network.go index 1b823234..a813bc42 100644 --- a/clients/instance/ibm-pi-network.go +++ b/clients/instance/ibm-pi-network.go @@ -8,6 +8,7 @@ import ( "github.com/IBM-Cloud/power-go-client/helpers" "github.com/IBM-Cloud/power-go-client/ibmpisession" + "github.com/IBM-Cloud/power-go-client/power/client/networks" "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks" "github.com/IBM-Cloud/power-go-client/power/models" ) @@ -196,3 +197,65 @@ func (f *IBMPINetworkClient) UpdatePort(id, networkPortID string, body *models.N } return resp.Payload, nil } + +// Create a network interface +func (f *IBMPINetworkClient) CreateNetworkInterface(id string, body *models.NetworkInterfaceCreate) (*models.NetworkInterface, error) { + params := networks.NewV1NetworksNetworkInterfacesPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithNetworkID(id).WithBody(body) + resp, err := f.session.Power.Networks.V1NetworksNetworkInterfacesPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to create network interface for network %s with %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to create network interface for network %s", id) + } + return resp.Payload, nil +} + +// Get all Create a network interface +func (f *IBMPINetworkClient) GetAllNetworkInterfaces(id string) (*models.NetworkInterfaces, error) { + params := networks.NewV1NetworksNetworkInterfacesGetallParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithNetworkID(id) + resp, err := f.session.Power.Networks.V1NetworksNetworkInterfacesGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to get all network interfaces for network %s: %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get all network interfaces for network %s", id) + } + return resp.Payload, nil +} + +// Get a network interface +func (f *IBMPINetworkClient) GetNetworkInterface(id, netIntID string) (*models.NetworkInterface, error) { + params := networks.NewV1NetworksNetworkInterfacesGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithNetworkID(id).WithNetworkInterfaceID(netIntID) + resp, err := f.session.Power.Networks.V1NetworksNetworkInterfacesGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to get network interace %s for network %s: %w", netIntID, id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get network interface %s for network %s", netIntID, id) + } + return resp.Payload, nil +} + +// Update a network interface +func (f *IBMPINetworkClient) UpdateNetworkInterface(id, netIntID string, body *models.NetworkInterfaceUpdate) (*models.NetworkInterface, error) { + params := networks.NewV1NetworksNetworkInterfacesPutParams().WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut).WithNetworkID(id).WithNetworkInterfaceID(netIntID).WithBody(body) + resp, err := f.session.Power.Networks.V1NetworksNetworkInterfacesPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to update network interface %s and network %s with error %w", netIntID, id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to update network interface %s and network %s", netIntID, id) + } + return resp.Payload, nil +} + +// Delete a network interface +func (f *IBMPINetworkClient) DeleteNetworkInterface(id, netIntID string) error { + params := networks.NewV1NetworksNetworkInterfacesDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut).WithNetworkID(id).WithNetworkInterfaceID(netIntID) + _, err := f.session.Power.Networks.V1NetworksNetworkInterfacesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf("failed to delete network interface %s for network %s with error %w", netIntID, id, err) + } + return nil +} diff --git a/power/client/networks/networks_client.go b/power/client/networks/networks_client.go new file mode 100644 index 00000000..3358bc96 --- /dev/null +++ b/power/client/networks/networks_client.go @@ -0,0 +1,270 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new networks API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new networks API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new networks API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for networks API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + V1NetworksNetworkInterfacesDelete(params *V1NetworksNetworkInterfacesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworksNetworkInterfacesDeleteOK, error) + + V1NetworksNetworkInterfacesGet(params *V1NetworksNetworkInterfacesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworksNetworkInterfacesGetOK, error) + + V1NetworksNetworkInterfacesGetall(params *V1NetworksNetworkInterfacesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworksNetworkInterfacesGetallOK, error) + + V1NetworksNetworkInterfacesPost(params *V1NetworksNetworkInterfacesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworksNetworkInterfacesPostCreated, error) + + V1NetworksNetworkInterfacesPut(params *V1NetworksNetworkInterfacesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworksNetworkInterfacesPutOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +V1NetworksNetworkInterfacesDelete deletes a network interface +*/ +func (a *Client) V1NetworksNetworkInterfacesDelete(params *V1NetworksNetworkInterfacesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworksNetworkInterfacesDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworksNetworkInterfacesDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networks.network-interfaces.delete", + Method: "DELETE", + PathPattern: "/v1/networks/{network_id}/network-interfaces/{network_interface_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworksNetworkInterfacesDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*V1NetworksNetworkInterfacesDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for v1.networks.network-interfaces.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworksNetworkInterfacesGet gets a network interface s information +*/ +func (a *Client) V1NetworksNetworkInterfacesGet(params *V1NetworksNetworkInterfacesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworksNetworkInterfacesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworksNetworkInterfacesGetParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networks.network-interfaces.get", + Method: "GET", + PathPattern: "/v1/networks/{network_id}/network-interfaces/{network_interface_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworksNetworkInterfacesGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*V1NetworksNetworkInterfacesGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for v1.networks.network-interfaces.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworksNetworkInterfacesGetall gets all network interfaces for this network +*/ +func (a *Client) V1NetworksNetworkInterfacesGetall(params *V1NetworksNetworkInterfacesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworksNetworkInterfacesGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworksNetworkInterfacesGetallParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networks.network-interfaces.getall", + Method: "GET", + PathPattern: "/v1/networks/{network_id}/network-interfaces", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworksNetworkInterfacesGetallReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*V1NetworksNetworkInterfacesGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for v1.networks.network-interfaces.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworksNetworkInterfacesPost performs network interface addition deletion and listing +*/ +func (a *Client) V1NetworksNetworkInterfacesPost(params *V1NetworksNetworkInterfacesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworksNetworkInterfacesPostCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworksNetworkInterfacesPostParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networks.network-interfaces.post", + Method: "POST", + PathPattern: "/v1/networks/{network_id}/network-interfaces", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworksNetworkInterfacesPostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*V1NetworksNetworkInterfacesPostCreated) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for v1.networks.network-interfaces.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworksNetworkInterfacesPut updates a network interface s information +*/ +func (a *Client) V1NetworksNetworkInterfacesPut(params *V1NetworksNetworkInterfacesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworksNetworkInterfacesPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworksNetworkInterfacesPutParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networks.network-interfaces.put", + Method: "PUT", + PathPattern: "/v1/networks/{network_id}/network-interfaces/{network_interface_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworksNetworkInterfacesPutReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*V1NetworksNetworkInterfacesPutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for v1.networks.network-interfaces.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/power/client/networks/v1_networks_network_interfaces_delete_parameters.go b/power/client/networks/v1_networks_network_interfaces_delete_parameters.go new file mode 100644 index 00000000..e68d59ee --- /dev/null +++ b/power/client/networks/v1_networks_network_interfaces_delete_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewV1NetworksNetworkInterfacesDeleteParams creates a new V1NetworksNetworkInterfacesDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworksNetworkInterfacesDeleteParams() *V1NetworksNetworkInterfacesDeleteParams { + return &V1NetworksNetworkInterfacesDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworksNetworkInterfacesDeleteParamsWithTimeout creates a new V1NetworksNetworkInterfacesDeleteParams object +// with the ability to set a timeout on a request. +func NewV1NetworksNetworkInterfacesDeleteParamsWithTimeout(timeout time.Duration) *V1NetworksNetworkInterfacesDeleteParams { + return &V1NetworksNetworkInterfacesDeleteParams{ + timeout: timeout, + } +} + +// NewV1NetworksNetworkInterfacesDeleteParamsWithContext creates a new V1NetworksNetworkInterfacesDeleteParams object +// with the ability to set a context for a request. +func NewV1NetworksNetworkInterfacesDeleteParamsWithContext(ctx context.Context) *V1NetworksNetworkInterfacesDeleteParams { + return &V1NetworksNetworkInterfacesDeleteParams{ + Context: ctx, + } +} + +// NewV1NetworksNetworkInterfacesDeleteParamsWithHTTPClient creates a new V1NetworksNetworkInterfacesDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworksNetworkInterfacesDeleteParamsWithHTTPClient(client *http.Client) *V1NetworksNetworkInterfacesDeleteParams { + return &V1NetworksNetworkInterfacesDeleteParams{ + HTTPClient: client, + } +} + +/* +V1NetworksNetworkInterfacesDeleteParams contains all the parameters to send to the API endpoint + + for the v1 networks network interfaces delete operation. + + Typically these are written to a http.Request. +*/ +type V1NetworksNetworkInterfacesDeleteParams struct { + + /* NetworkID. + + Network ID + */ + NetworkID string + + /* NetworkInterfaceID. + + Network Interface ID + */ + NetworkInterfaceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 networks network interfaces delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworksNetworkInterfacesDeleteParams) WithDefaults() *V1NetworksNetworkInterfacesDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 networks network interfaces delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworksNetworkInterfacesDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 networks network interfaces delete params +func (o *V1NetworksNetworkInterfacesDeleteParams) WithTimeout(timeout time.Duration) *V1NetworksNetworkInterfacesDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 networks network interfaces delete params +func (o *V1NetworksNetworkInterfacesDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 networks network interfaces delete params +func (o *V1NetworksNetworkInterfacesDeleteParams) WithContext(ctx context.Context) *V1NetworksNetworkInterfacesDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 networks network interfaces delete params +func (o *V1NetworksNetworkInterfacesDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 networks network interfaces delete params +func (o *V1NetworksNetworkInterfacesDeleteParams) WithHTTPClient(client *http.Client) *V1NetworksNetworkInterfacesDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 networks network interfaces delete params +func (o *V1NetworksNetworkInterfacesDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNetworkID adds the networkID to the v1 networks network interfaces delete params +func (o *V1NetworksNetworkInterfacesDeleteParams) WithNetworkID(networkID string) *V1NetworksNetworkInterfacesDeleteParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the v1 networks network interfaces delete params +func (o *V1NetworksNetworkInterfacesDeleteParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WithNetworkInterfaceID adds the networkInterfaceID to the v1 networks network interfaces delete params +func (o *V1NetworksNetworkInterfacesDeleteParams) WithNetworkInterfaceID(networkInterfaceID string) *V1NetworksNetworkInterfacesDeleteParams { + o.SetNetworkInterfaceID(networkInterfaceID) + return o +} + +// SetNetworkInterfaceID adds the networkInterfaceId to the v1 networks network interfaces delete params +func (o *V1NetworksNetworkInterfacesDeleteParams) SetNetworkInterfaceID(networkInterfaceID string) { + o.NetworkInterfaceID = networkInterfaceID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworksNetworkInterfacesDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + // path param network_interface_id + if err := r.SetPathParam("network_interface_id", o.NetworkInterfaceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/networks/v1_networks_network_interfaces_delete_responses.go b/power/client/networks/v1_networks_network_interfaces_delete_responses.go new file mode 100644 index 00000000..8c525d4a --- /dev/null +++ b/power/client/networks/v1_networks_network_interfaces_delete_responses.go @@ -0,0 +1,560 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworksNetworkInterfacesDeleteReader is a Reader for the V1NetworksNetworkInterfacesDelete structure. +type V1NetworksNetworkInterfacesDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworksNetworkInterfacesDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworksNetworkInterfacesDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworksNetworkInterfacesDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworksNetworkInterfacesDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworksNetworkInterfacesDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworksNetworkInterfacesDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 410: + result := NewV1NetworksNetworkInterfacesDeleteGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworksNetworkInterfacesDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}] v1.networks.network-interfaces.delete", response, response.Code()) + } +} + +// NewV1NetworksNetworkInterfacesDeleteOK creates a V1NetworksNetworkInterfacesDeleteOK with default headers values +func NewV1NetworksNetworkInterfacesDeleteOK() *V1NetworksNetworkInterfacesDeleteOK { + return &V1NetworksNetworkInterfacesDeleteOK{} +} + +/* +V1NetworksNetworkInterfacesDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworksNetworkInterfacesDeleteOK struct { + Payload models.Object +} + +// IsSuccess returns true when this v1 networks network interfaces delete o k response has a 2xx status code +func (o *V1NetworksNetworkInterfacesDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 networks network interfaces delete o k response has a 3xx status code +func (o *V1NetworksNetworkInterfacesDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces delete o k response has a 4xx status code +func (o *V1NetworksNetworkInterfacesDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 networks network interfaces delete o k response has a 5xx status code +func (o *V1NetworksNetworkInterfacesDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces delete o k response a status code equal to that given +func (o *V1NetworksNetworkInterfacesDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 networks network interfaces delete o k response +func (o *V1NetworksNetworkInterfacesDeleteOK) Code() int { + return 200 +} + +func (o *V1NetworksNetworkInterfacesDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteOK %s", 200, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteOK %s", 200, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesDeleteBadRequest creates a V1NetworksNetworkInterfacesDeleteBadRequest with default headers values +func NewV1NetworksNetworkInterfacesDeleteBadRequest() *V1NetworksNetworkInterfacesDeleteBadRequest { + return &V1NetworksNetworkInterfacesDeleteBadRequest{} +} + +/* +V1NetworksNetworkInterfacesDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworksNetworkInterfacesDeleteBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces delete bad request response has a 2xx status code +func (o *V1NetworksNetworkInterfacesDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces delete bad request response has a 3xx status code +func (o *V1NetworksNetworkInterfacesDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces delete bad request response has a 4xx status code +func (o *V1NetworksNetworkInterfacesDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces delete bad request response has a 5xx status code +func (o *V1NetworksNetworkInterfacesDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces delete bad request response a status code equal to that given +func (o *V1NetworksNetworkInterfacesDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 networks network interfaces delete bad request response +func (o *V1NetworksNetworkInterfacesDeleteBadRequest) Code() int { + return 400 +} + +func (o *V1NetworksNetworkInterfacesDeleteBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesDeleteUnauthorized creates a V1NetworksNetworkInterfacesDeleteUnauthorized with default headers values +func NewV1NetworksNetworkInterfacesDeleteUnauthorized() *V1NetworksNetworkInterfacesDeleteUnauthorized { + return &V1NetworksNetworkInterfacesDeleteUnauthorized{} +} + +/* +V1NetworksNetworkInterfacesDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworksNetworkInterfacesDeleteUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces delete unauthorized response has a 2xx status code +func (o *V1NetworksNetworkInterfacesDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces delete unauthorized response has a 3xx status code +func (o *V1NetworksNetworkInterfacesDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces delete unauthorized response has a 4xx status code +func (o *V1NetworksNetworkInterfacesDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces delete unauthorized response has a 5xx status code +func (o *V1NetworksNetworkInterfacesDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces delete unauthorized response a status code equal to that given +func (o *V1NetworksNetworkInterfacesDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 networks network interfaces delete unauthorized response +func (o *V1NetworksNetworkInterfacesDeleteUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworksNetworkInterfacesDeleteUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesDeleteForbidden creates a V1NetworksNetworkInterfacesDeleteForbidden with default headers values +func NewV1NetworksNetworkInterfacesDeleteForbidden() *V1NetworksNetworkInterfacesDeleteForbidden { + return &V1NetworksNetworkInterfacesDeleteForbidden{} +} + +/* +V1NetworksNetworkInterfacesDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworksNetworkInterfacesDeleteForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces delete forbidden response has a 2xx status code +func (o *V1NetworksNetworkInterfacesDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces delete forbidden response has a 3xx status code +func (o *V1NetworksNetworkInterfacesDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces delete forbidden response has a 4xx status code +func (o *V1NetworksNetworkInterfacesDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces delete forbidden response has a 5xx status code +func (o *V1NetworksNetworkInterfacesDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces delete forbidden response a status code equal to that given +func (o *V1NetworksNetworkInterfacesDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 networks network interfaces delete forbidden response +func (o *V1NetworksNetworkInterfacesDeleteForbidden) Code() int { + return 403 +} + +func (o *V1NetworksNetworkInterfacesDeleteForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesDeleteNotFound creates a V1NetworksNetworkInterfacesDeleteNotFound with default headers values +func NewV1NetworksNetworkInterfacesDeleteNotFound() *V1NetworksNetworkInterfacesDeleteNotFound { + return &V1NetworksNetworkInterfacesDeleteNotFound{} +} + +/* +V1NetworksNetworkInterfacesDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworksNetworkInterfacesDeleteNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces delete not found response has a 2xx status code +func (o *V1NetworksNetworkInterfacesDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces delete not found response has a 3xx status code +func (o *V1NetworksNetworkInterfacesDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces delete not found response has a 4xx status code +func (o *V1NetworksNetworkInterfacesDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces delete not found response has a 5xx status code +func (o *V1NetworksNetworkInterfacesDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces delete not found response a status code equal to that given +func (o *V1NetworksNetworkInterfacesDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 networks network interfaces delete not found response +func (o *V1NetworksNetworkInterfacesDeleteNotFound) Code() int { + return 404 +} + +func (o *V1NetworksNetworkInterfacesDeleteNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesDeleteGone creates a V1NetworksNetworkInterfacesDeleteGone with default headers values +func NewV1NetworksNetworkInterfacesDeleteGone() *V1NetworksNetworkInterfacesDeleteGone { + return &V1NetworksNetworkInterfacesDeleteGone{} +} + +/* +V1NetworksNetworkInterfacesDeleteGone describes a response with status code 410, with default header values. + +Gone +*/ +type V1NetworksNetworkInterfacesDeleteGone struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces delete gone response has a 2xx status code +func (o *V1NetworksNetworkInterfacesDeleteGone) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces delete gone response has a 3xx status code +func (o *V1NetworksNetworkInterfacesDeleteGone) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces delete gone response has a 4xx status code +func (o *V1NetworksNetworkInterfacesDeleteGone) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces delete gone response has a 5xx status code +func (o *V1NetworksNetworkInterfacesDeleteGone) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces delete gone response a status code equal to that given +func (o *V1NetworksNetworkInterfacesDeleteGone) IsCode(code int) bool { + return code == 410 +} + +// Code gets the status code for the v1 networks network interfaces delete gone response +func (o *V1NetworksNetworkInterfacesDeleteGone) Code() int { + return 410 +} + +func (o *V1NetworksNetworkInterfacesDeleteGone) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteGone %s", 410, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteGone) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteGone %s", 410, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesDeleteGone) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesDeleteInternalServerError creates a V1NetworksNetworkInterfacesDeleteInternalServerError with default headers values +func NewV1NetworksNetworkInterfacesDeleteInternalServerError() *V1NetworksNetworkInterfacesDeleteInternalServerError { + return &V1NetworksNetworkInterfacesDeleteInternalServerError{} +} + +/* +V1NetworksNetworkInterfacesDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworksNetworkInterfacesDeleteInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces delete internal server error response has a 2xx status code +func (o *V1NetworksNetworkInterfacesDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces delete internal server error response has a 3xx status code +func (o *V1NetworksNetworkInterfacesDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces delete internal server error response has a 4xx status code +func (o *V1NetworksNetworkInterfacesDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 networks network interfaces delete internal server error response has a 5xx status code +func (o *V1NetworksNetworkInterfacesDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 networks network interfaces delete internal server error response a status code equal to that given +func (o *V1NetworksNetworkInterfacesDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 networks network interfaces delete internal server error response +func (o *V1NetworksNetworkInterfacesDeleteInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworksNetworkInterfacesDeleteInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworksNetworkInterfacesDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/networks/v1_networks_network_interfaces_get_parameters.go b/power/client/networks/v1_networks_network_interfaces_get_parameters.go new file mode 100644 index 00000000..431fd192 --- /dev/null +++ b/power/client/networks/v1_networks_network_interfaces_get_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewV1NetworksNetworkInterfacesGetParams creates a new V1NetworksNetworkInterfacesGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworksNetworkInterfacesGetParams() *V1NetworksNetworkInterfacesGetParams { + return &V1NetworksNetworkInterfacesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworksNetworkInterfacesGetParamsWithTimeout creates a new V1NetworksNetworkInterfacesGetParams object +// with the ability to set a timeout on a request. +func NewV1NetworksNetworkInterfacesGetParamsWithTimeout(timeout time.Duration) *V1NetworksNetworkInterfacesGetParams { + return &V1NetworksNetworkInterfacesGetParams{ + timeout: timeout, + } +} + +// NewV1NetworksNetworkInterfacesGetParamsWithContext creates a new V1NetworksNetworkInterfacesGetParams object +// with the ability to set a context for a request. +func NewV1NetworksNetworkInterfacesGetParamsWithContext(ctx context.Context) *V1NetworksNetworkInterfacesGetParams { + return &V1NetworksNetworkInterfacesGetParams{ + Context: ctx, + } +} + +// NewV1NetworksNetworkInterfacesGetParamsWithHTTPClient creates a new V1NetworksNetworkInterfacesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworksNetworkInterfacesGetParamsWithHTTPClient(client *http.Client) *V1NetworksNetworkInterfacesGetParams { + return &V1NetworksNetworkInterfacesGetParams{ + HTTPClient: client, + } +} + +/* +V1NetworksNetworkInterfacesGetParams contains all the parameters to send to the API endpoint + + for the v1 networks network interfaces get operation. + + Typically these are written to a http.Request. +*/ +type V1NetworksNetworkInterfacesGetParams struct { + + /* NetworkID. + + Network ID + */ + NetworkID string + + /* NetworkInterfaceID. + + Network Interface ID + */ + NetworkInterfaceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 networks network interfaces get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworksNetworkInterfacesGetParams) WithDefaults() *V1NetworksNetworkInterfacesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 networks network interfaces get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworksNetworkInterfacesGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 networks network interfaces get params +func (o *V1NetworksNetworkInterfacesGetParams) WithTimeout(timeout time.Duration) *V1NetworksNetworkInterfacesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 networks network interfaces get params +func (o *V1NetworksNetworkInterfacesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 networks network interfaces get params +func (o *V1NetworksNetworkInterfacesGetParams) WithContext(ctx context.Context) *V1NetworksNetworkInterfacesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 networks network interfaces get params +func (o *V1NetworksNetworkInterfacesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 networks network interfaces get params +func (o *V1NetworksNetworkInterfacesGetParams) WithHTTPClient(client *http.Client) *V1NetworksNetworkInterfacesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 networks network interfaces get params +func (o *V1NetworksNetworkInterfacesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNetworkID adds the networkID to the v1 networks network interfaces get params +func (o *V1NetworksNetworkInterfacesGetParams) WithNetworkID(networkID string) *V1NetworksNetworkInterfacesGetParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the v1 networks network interfaces get params +func (o *V1NetworksNetworkInterfacesGetParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WithNetworkInterfaceID adds the networkInterfaceID to the v1 networks network interfaces get params +func (o *V1NetworksNetworkInterfacesGetParams) WithNetworkInterfaceID(networkInterfaceID string) *V1NetworksNetworkInterfacesGetParams { + o.SetNetworkInterfaceID(networkInterfaceID) + return o +} + +// SetNetworkInterfaceID adds the networkInterfaceId to the v1 networks network interfaces get params +func (o *V1NetworksNetworkInterfacesGetParams) SetNetworkInterfaceID(networkInterfaceID string) { + o.NetworkInterfaceID = networkInterfaceID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworksNetworkInterfacesGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + // path param network_interface_id + if err := r.SetPathParam("network_interface_id", o.NetworkInterfaceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/networks/v1_networks_network_interfaces_get_responses.go b/power/client/networks/v1_networks_network_interfaces_get_responses.go new file mode 100644 index 00000000..8efe1ce3 --- /dev/null +++ b/power/client/networks/v1_networks_network_interfaces_get_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworksNetworkInterfacesGetReader is a Reader for the V1NetworksNetworkInterfacesGet structure. +type V1NetworksNetworkInterfacesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworksNetworkInterfacesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworksNetworkInterfacesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworksNetworkInterfacesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworksNetworkInterfacesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworksNetworkInterfacesGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworksNetworkInterfacesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworksNetworkInterfacesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}] v1.networks.network-interfaces.get", response, response.Code()) + } +} + +// NewV1NetworksNetworkInterfacesGetOK creates a V1NetworksNetworkInterfacesGetOK with default headers values +func NewV1NetworksNetworkInterfacesGetOK() *V1NetworksNetworkInterfacesGetOK { + return &V1NetworksNetworkInterfacesGetOK{} +} + +/* +V1NetworksNetworkInterfacesGetOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworksNetworkInterfacesGetOK struct { + Payload *models.NetworkInterface +} + +// IsSuccess returns true when this v1 networks network interfaces get o k response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 networks network interfaces get o k response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces get o k response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 networks network interfaces get o k response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces get o k response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 networks network interfaces get o k response +func (o *V1NetworksNetworkInterfacesGetOK) Code() int { + return 200 +} + +func (o *V1NetworksNetworkInterfacesGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetOK %s", 200, payload) +} + +func (o *V1NetworksNetworkInterfacesGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetOK %s", 200, payload) +} + +func (o *V1NetworksNetworkInterfacesGetOK) GetPayload() *models.NetworkInterface { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkInterface) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesGetBadRequest creates a V1NetworksNetworkInterfacesGetBadRequest with default headers values +func NewV1NetworksNetworkInterfacesGetBadRequest() *V1NetworksNetworkInterfacesGetBadRequest { + return &V1NetworksNetworkInterfacesGetBadRequest{} +} + +/* +V1NetworksNetworkInterfacesGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworksNetworkInterfacesGetBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces get bad request response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces get bad request response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces get bad request response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces get bad request response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces get bad request response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 networks network interfaces get bad request response +func (o *V1NetworksNetworkInterfacesGetBadRequest) Code() int { + return 400 +} + +func (o *V1NetworksNetworkInterfacesGetBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetBadRequest %s", 400, payload) +} + +func (o *V1NetworksNetworkInterfacesGetBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetBadRequest %s", 400, payload) +} + +func (o *V1NetworksNetworkInterfacesGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesGetUnauthorized creates a V1NetworksNetworkInterfacesGetUnauthorized with default headers values +func NewV1NetworksNetworkInterfacesGetUnauthorized() *V1NetworksNetworkInterfacesGetUnauthorized { + return &V1NetworksNetworkInterfacesGetUnauthorized{} +} + +/* +V1NetworksNetworkInterfacesGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworksNetworkInterfacesGetUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces get unauthorized response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces get unauthorized response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces get unauthorized response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces get unauthorized response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces get unauthorized response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 networks network interfaces get unauthorized response +func (o *V1NetworksNetworkInterfacesGetUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworksNetworkInterfacesGetUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetUnauthorized %s", 401, payload) +} + +func (o *V1NetworksNetworkInterfacesGetUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetUnauthorized %s", 401, payload) +} + +func (o *V1NetworksNetworkInterfacesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesGetForbidden creates a V1NetworksNetworkInterfacesGetForbidden with default headers values +func NewV1NetworksNetworkInterfacesGetForbidden() *V1NetworksNetworkInterfacesGetForbidden { + return &V1NetworksNetworkInterfacesGetForbidden{} +} + +/* +V1NetworksNetworkInterfacesGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworksNetworkInterfacesGetForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces get forbidden response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces get forbidden response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces get forbidden response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces get forbidden response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces get forbidden response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 networks network interfaces get forbidden response +func (o *V1NetworksNetworkInterfacesGetForbidden) Code() int { + return 403 +} + +func (o *V1NetworksNetworkInterfacesGetForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetForbidden %s", 403, payload) +} + +func (o *V1NetworksNetworkInterfacesGetForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetForbidden %s", 403, payload) +} + +func (o *V1NetworksNetworkInterfacesGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesGetNotFound creates a V1NetworksNetworkInterfacesGetNotFound with default headers values +func NewV1NetworksNetworkInterfacesGetNotFound() *V1NetworksNetworkInterfacesGetNotFound { + return &V1NetworksNetworkInterfacesGetNotFound{} +} + +/* +V1NetworksNetworkInterfacesGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworksNetworkInterfacesGetNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces get not found response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces get not found response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces get not found response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces get not found response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces get not found response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 networks network interfaces get not found response +func (o *V1NetworksNetworkInterfacesGetNotFound) Code() int { + return 404 +} + +func (o *V1NetworksNetworkInterfacesGetNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetNotFound %s", 404, payload) +} + +func (o *V1NetworksNetworkInterfacesGetNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetNotFound %s", 404, payload) +} + +func (o *V1NetworksNetworkInterfacesGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesGetInternalServerError creates a V1NetworksNetworkInterfacesGetInternalServerError with default headers values +func NewV1NetworksNetworkInterfacesGetInternalServerError() *V1NetworksNetworkInterfacesGetInternalServerError { + return &V1NetworksNetworkInterfacesGetInternalServerError{} +} + +/* +V1NetworksNetworkInterfacesGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworksNetworkInterfacesGetInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces get internal server error response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces get internal server error response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces get internal server error response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 networks network interfaces get internal server error response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 networks network interfaces get internal server error response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 networks network interfaces get internal server error response +func (o *V1NetworksNetworkInterfacesGetInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworksNetworkInterfacesGetInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetInternalServerError %s", 500, payload) +} + +func (o *V1NetworksNetworkInterfacesGetInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesGetInternalServerError %s", 500, payload) +} + +func (o *V1NetworksNetworkInterfacesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/networks/v1_networks_network_interfaces_getall_parameters.go b/power/client/networks/v1_networks_network_interfaces_getall_parameters.go new file mode 100644 index 00000000..2e7b75a2 --- /dev/null +++ b/power/client/networks/v1_networks_network_interfaces_getall_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewV1NetworksNetworkInterfacesGetallParams creates a new V1NetworksNetworkInterfacesGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworksNetworkInterfacesGetallParams() *V1NetworksNetworkInterfacesGetallParams { + return &V1NetworksNetworkInterfacesGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworksNetworkInterfacesGetallParamsWithTimeout creates a new V1NetworksNetworkInterfacesGetallParams object +// with the ability to set a timeout on a request. +func NewV1NetworksNetworkInterfacesGetallParamsWithTimeout(timeout time.Duration) *V1NetworksNetworkInterfacesGetallParams { + return &V1NetworksNetworkInterfacesGetallParams{ + timeout: timeout, + } +} + +// NewV1NetworksNetworkInterfacesGetallParamsWithContext creates a new V1NetworksNetworkInterfacesGetallParams object +// with the ability to set a context for a request. +func NewV1NetworksNetworkInterfacesGetallParamsWithContext(ctx context.Context) *V1NetworksNetworkInterfacesGetallParams { + return &V1NetworksNetworkInterfacesGetallParams{ + Context: ctx, + } +} + +// NewV1NetworksNetworkInterfacesGetallParamsWithHTTPClient creates a new V1NetworksNetworkInterfacesGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworksNetworkInterfacesGetallParamsWithHTTPClient(client *http.Client) *V1NetworksNetworkInterfacesGetallParams { + return &V1NetworksNetworkInterfacesGetallParams{ + HTTPClient: client, + } +} + +/* +V1NetworksNetworkInterfacesGetallParams contains all the parameters to send to the API endpoint + + for the v1 networks network interfaces getall operation. + + Typically these are written to a http.Request. +*/ +type V1NetworksNetworkInterfacesGetallParams struct { + + /* NetworkID. + + Network ID + */ + NetworkID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 networks network interfaces getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworksNetworkInterfacesGetallParams) WithDefaults() *V1NetworksNetworkInterfacesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 networks network interfaces getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworksNetworkInterfacesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 networks network interfaces getall params +func (o *V1NetworksNetworkInterfacesGetallParams) WithTimeout(timeout time.Duration) *V1NetworksNetworkInterfacesGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 networks network interfaces getall params +func (o *V1NetworksNetworkInterfacesGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 networks network interfaces getall params +func (o *V1NetworksNetworkInterfacesGetallParams) WithContext(ctx context.Context) *V1NetworksNetworkInterfacesGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 networks network interfaces getall params +func (o *V1NetworksNetworkInterfacesGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 networks network interfaces getall params +func (o *V1NetworksNetworkInterfacesGetallParams) WithHTTPClient(client *http.Client) *V1NetworksNetworkInterfacesGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 networks network interfaces getall params +func (o *V1NetworksNetworkInterfacesGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNetworkID adds the networkID to the v1 networks network interfaces getall params +func (o *V1NetworksNetworkInterfacesGetallParams) WithNetworkID(networkID string) *V1NetworksNetworkInterfacesGetallParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the v1 networks network interfaces getall params +func (o *V1NetworksNetworkInterfacesGetallParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworksNetworkInterfacesGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/networks/v1_networks_network_interfaces_getall_responses.go b/power/client/networks/v1_networks_network_interfaces_getall_responses.go new file mode 100644 index 00000000..753cc0a9 --- /dev/null +++ b/power/client/networks/v1_networks_network_interfaces_getall_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworksNetworkInterfacesGetallReader is a Reader for the V1NetworksNetworkInterfacesGetall structure. +type V1NetworksNetworkInterfacesGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworksNetworkInterfacesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworksNetworkInterfacesGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworksNetworkInterfacesGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworksNetworkInterfacesGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworksNetworkInterfacesGetallForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworksNetworkInterfacesGetallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworksNetworkInterfacesGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/networks/{network_id}/network-interfaces] v1.networks.network-interfaces.getall", response, response.Code()) + } +} + +// NewV1NetworksNetworkInterfacesGetallOK creates a V1NetworksNetworkInterfacesGetallOK with default headers values +func NewV1NetworksNetworkInterfacesGetallOK() *V1NetworksNetworkInterfacesGetallOK { + return &V1NetworksNetworkInterfacesGetallOK{} +} + +/* +V1NetworksNetworkInterfacesGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworksNetworkInterfacesGetallOK struct { + Payload *models.NetworkInterfaces +} + +// IsSuccess returns true when this v1 networks network interfaces getall o k response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetallOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 networks network interfaces getall o k response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetallOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces getall o k response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetallOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 networks network interfaces getall o k response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetallOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces getall o k response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetallOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 networks network interfaces getall o k response +func (o *V1NetworksNetworkInterfacesGetallOK) Code() int { + return 200 +} + +func (o *V1NetworksNetworkInterfacesGetallOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallOK %s", 200, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallOK %s", 200, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallOK) GetPayload() *models.NetworkInterfaces { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkInterfaces) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesGetallBadRequest creates a V1NetworksNetworkInterfacesGetallBadRequest with default headers values +func NewV1NetworksNetworkInterfacesGetallBadRequest() *V1NetworksNetworkInterfacesGetallBadRequest { + return &V1NetworksNetworkInterfacesGetallBadRequest{} +} + +/* +V1NetworksNetworkInterfacesGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworksNetworkInterfacesGetallBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces getall bad request response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetallBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces getall bad request response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetallBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces getall bad request response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetallBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces getall bad request response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetallBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces getall bad request response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetallBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 networks network interfaces getall bad request response +func (o *V1NetworksNetworkInterfacesGetallBadRequest) Code() int { + return 400 +} + +func (o *V1NetworksNetworkInterfacesGetallBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallBadRequest %s", 400, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallBadRequest %s", 400, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesGetallUnauthorized creates a V1NetworksNetworkInterfacesGetallUnauthorized with default headers values +func NewV1NetworksNetworkInterfacesGetallUnauthorized() *V1NetworksNetworkInterfacesGetallUnauthorized { + return &V1NetworksNetworkInterfacesGetallUnauthorized{} +} + +/* +V1NetworksNetworkInterfacesGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworksNetworkInterfacesGetallUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces getall unauthorized response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetallUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces getall unauthorized response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetallUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces getall unauthorized response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetallUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces getall unauthorized response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetallUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces getall unauthorized response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetallUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 networks network interfaces getall unauthorized response +func (o *V1NetworksNetworkInterfacesGetallUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworksNetworkInterfacesGetallUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallUnauthorized %s", 401, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallUnauthorized %s", 401, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesGetallForbidden creates a V1NetworksNetworkInterfacesGetallForbidden with default headers values +func NewV1NetworksNetworkInterfacesGetallForbidden() *V1NetworksNetworkInterfacesGetallForbidden { + return &V1NetworksNetworkInterfacesGetallForbidden{} +} + +/* +V1NetworksNetworkInterfacesGetallForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworksNetworkInterfacesGetallForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces getall forbidden response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetallForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces getall forbidden response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetallForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces getall forbidden response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetallForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces getall forbidden response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetallForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces getall forbidden response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetallForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 networks network interfaces getall forbidden response +func (o *V1NetworksNetworkInterfacesGetallForbidden) Code() int { + return 403 +} + +func (o *V1NetworksNetworkInterfacesGetallForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallForbidden %s", 403, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallForbidden %s", 403, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetallForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesGetallNotFound creates a V1NetworksNetworkInterfacesGetallNotFound with default headers values +func NewV1NetworksNetworkInterfacesGetallNotFound() *V1NetworksNetworkInterfacesGetallNotFound { + return &V1NetworksNetworkInterfacesGetallNotFound{} +} + +/* +V1NetworksNetworkInterfacesGetallNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworksNetworkInterfacesGetallNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces getall not found response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetallNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces getall not found response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetallNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces getall not found response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetallNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces getall not found response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetallNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces getall not found response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetallNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 networks network interfaces getall not found response +func (o *V1NetworksNetworkInterfacesGetallNotFound) Code() int { + return 404 +} + +func (o *V1NetworksNetworkInterfacesGetallNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallNotFound %s", 404, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallNotFound %s", 404, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetallNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesGetallInternalServerError creates a V1NetworksNetworkInterfacesGetallInternalServerError with default headers values +func NewV1NetworksNetworkInterfacesGetallInternalServerError() *V1NetworksNetworkInterfacesGetallInternalServerError { + return &V1NetworksNetworkInterfacesGetallInternalServerError{} +} + +/* +V1NetworksNetworkInterfacesGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworksNetworkInterfacesGetallInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces getall internal server error response has a 2xx status code +func (o *V1NetworksNetworkInterfacesGetallInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces getall internal server error response has a 3xx status code +func (o *V1NetworksNetworkInterfacesGetallInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces getall internal server error response has a 4xx status code +func (o *V1NetworksNetworkInterfacesGetallInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 networks network interfaces getall internal server error response has a 5xx status code +func (o *V1NetworksNetworkInterfacesGetallInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 networks network interfaces getall internal server error response a status code equal to that given +func (o *V1NetworksNetworkInterfacesGetallInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 networks network interfaces getall internal server error response +func (o *V1NetworksNetworkInterfacesGetallInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworksNetworkInterfacesGetallInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallInternalServerError %s", 500, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesGetallInternalServerError %s", 500, payload) +} + +func (o *V1NetworksNetworkInterfacesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/networks/v1_networks_network_interfaces_post_parameters.go b/power/client/networks/v1_networks_network_interfaces_post_parameters.go new file mode 100644 index 00000000..46a62892 --- /dev/null +++ b/power/client/networks/v1_networks_network_interfaces_post_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// NewV1NetworksNetworkInterfacesPostParams creates a new V1NetworksNetworkInterfacesPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworksNetworkInterfacesPostParams() *V1NetworksNetworkInterfacesPostParams { + return &V1NetworksNetworkInterfacesPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworksNetworkInterfacesPostParamsWithTimeout creates a new V1NetworksNetworkInterfacesPostParams object +// with the ability to set a timeout on a request. +func NewV1NetworksNetworkInterfacesPostParamsWithTimeout(timeout time.Duration) *V1NetworksNetworkInterfacesPostParams { + return &V1NetworksNetworkInterfacesPostParams{ + timeout: timeout, + } +} + +// NewV1NetworksNetworkInterfacesPostParamsWithContext creates a new V1NetworksNetworkInterfacesPostParams object +// with the ability to set a context for a request. +func NewV1NetworksNetworkInterfacesPostParamsWithContext(ctx context.Context) *V1NetworksNetworkInterfacesPostParams { + return &V1NetworksNetworkInterfacesPostParams{ + Context: ctx, + } +} + +// NewV1NetworksNetworkInterfacesPostParamsWithHTTPClient creates a new V1NetworksNetworkInterfacesPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworksNetworkInterfacesPostParamsWithHTTPClient(client *http.Client) *V1NetworksNetworkInterfacesPostParams { + return &V1NetworksNetworkInterfacesPostParams{ + HTTPClient: client, + } +} + +/* +V1NetworksNetworkInterfacesPostParams contains all the parameters to send to the API endpoint + + for the v1 networks network interfaces post operation. + + Typically these are written to a http.Request. +*/ +type V1NetworksNetworkInterfacesPostParams struct { + + /* Body. + + Create a Network Interface + */ + Body *models.NetworkInterfaceCreate + + /* NetworkID. + + Network ID + */ + NetworkID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 networks network interfaces post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworksNetworkInterfacesPostParams) WithDefaults() *V1NetworksNetworkInterfacesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 networks network interfaces post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworksNetworkInterfacesPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 networks network interfaces post params +func (o *V1NetworksNetworkInterfacesPostParams) WithTimeout(timeout time.Duration) *V1NetworksNetworkInterfacesPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 networks network interfaces post params +func (o *V1NetworksNetworkInterfacesPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 networks network interfaces post params +func (o *V1NetworksNetworkInterfacesPostParams) WithContext(ctx context.Context) *V1NetworksNetworkInterfacesPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 networks network interfaces post params +func (o *V1NetworksNetworkInterfacesPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 networks network interfaces post params +func (o *V1NetworksNetworkInterfacesPostParams) WithHTTPClient(client *http.Client) *V1NetworksNetworkInterfacesPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 networks network interfaces post params +func (o *V1NetworksNetworkInterfacesPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 networks network interfaces post params +func (o *V1NetworksNetworkInterfacesPostParams) WithBody(body *models.NetworkInterfaceCreate) *V1NetworksNetworkInterfacesPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 networks network interfaces post params +func (o *V1NetworksNetworkInterfacesPostParams) SetBody(body *models.NetworkInterfaceCreate) { + o.Body = body +} + +// WithNetworkID adds the networkID to the v1 networks network interfaces post params +func (o *V1NetworksNetworkInterfacesPostParams) WithNetworkID(networkID string) *V1NetworksNetworkInterfacesPostParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the v1 networks network interfaces post params +func (o *V1NetworksNetworkInterfacesPostParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworksNetworkInterfacesPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/networks/v1_networks_network_interfaces_post_responses.go b/power/client/networks/v1_networks_network_interfaces_post_responses.go new file mode 100644 index 00000000..c071669c --- /dev/null +++ b/power/client/networks/v1_networks_network_interfaces_post_responses.go @@ -0,0 +1,638 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworksNetworkInterfacesPostReader is a Reader for the V1NetworksNetworkInterfacesPost structure. +type V1NetworksNetworkInterfacesPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworksNetworkInterfacesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 201: + result := NewV1NetworksNetworkInterfacesPostCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworksNetworkInterfacesPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworksNetworkInterfacesPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworksNetworkInterfacesPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworksNetworkInterfacesPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworksNetworkInterfacesPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewV1NetworksNetworkInterfacesPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworksNetworkInterfacesPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /v1/networks/{network_id}/network-interfaces] v1.networks.network-interfaces.post", response, response.Code()) + } +} + +// NewV1NetworksNetworkInterfacesPostCreated creates a V1NetworksNetworkInterfacesPostCreated with default headers values +func NewV1NetworksNetworkInterfacesPostCreated() *V1NetworksNetworkInterfacesPostCreated { + return &V1NetworksNetworkInterfacesPostCreated{} +} + +/* +V1NetworksNetworkInterfacesPostCreated describes a response with status code 201, with default header values. + +Created +*/ +type V1NetworksNetworkInterfacesPostCreated struct { + Payload *models.NetworkInterface +} + +// IsSuccess returns true when this v1 networks network interfaces post created response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPostCreated) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 networks network interfaces post created response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPostCreated) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces post created response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPostCreated) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 networks network interfaces post created response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPostCreated) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces post created response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPostCreated) IsCode(code int) bool { + return code == 201 +} + +// Code gets the status code for the v1 networks network interfaces post created response +func (o *V1NetworksNetworkInterfacesPostCreated) Code() int { + return 201 +} + +func (o *V1NetworksNetworkInterfacesPostCreated) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostCreated %s", 201, payload) +} + +func (o *V1NetworksNetworkInterfacesPostCreated) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostCreated %s", 201, payload) +} + +func (o *V1NetworksNetworkInterfacesPostCreated) GetPayload() *models.NetworkInterface { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkInterface) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesPostBadRequest creates a V1NetworksNetworkInterfacesPostBadRequest with default headers values +func NewV1NetworksNetworkInterfacesPostBadRequest() *V1NetworksNetworkInterfacesPostBadRequest { + return &V1NetworksNetworkInterfacesPostBadRequest{} +} + +/* +V1NetworksNetworkInterfacesPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworksNetworkInterfacesPostBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces post bad request response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces post bad request response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces post bad request response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces post bad request response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces post bad request response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 networks network interfaces post bad request response +func (o *V1NetworksNetworkInterfacesPostBadRequest) Code() int { + return 400 +} + +func (o *V1NetworksNetworkInterfacesPostBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostBadRequest %s", 400, payload) +} + +func (o *V1NetworksNetworkInterfacesPostBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostBadRequest %s", 400, payload) +} + +func (o *V1NetworksNetworkInterfacesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesPostUnauthorized creates a V1NetworksNetworkInterfacesPostUnauthorized with default headers values +func NewV1NetworksNetworkInterfacesPostUnauthorized() *V1NetworksNetworkInterfacesPostUnauthorized { + return &V1NetworksNetworkInterfacesPostUnauthorized{} +} + +/* +V1NetworksNetworkInterfacesPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworksNetworkInterfacesPostUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces post unauthorized response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces post unauthorized response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces post unauthorized response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces post unauthorized response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces post unauthorized response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 networks network interfaces post unauthorized response +func (o *V1NetworksNetworkInterfacesPostUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworksNetworkInterfacesPostUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworksNetworkInterfacesPostUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworksNetworkInterfacesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesPostForbidden creates a V1NetworksNetworkInterfacesPostForbidden with default headers values +func NewV1NetworksNetworkInterfacesPostForbidden() *V1NetworksNetworkInterfacesPostForbidden { + return &V1NetworksNetworkInterfacesPostForbidden{} +} + +/* +V1NetworksNetworkInterfacesPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworksNetworkInterfacesPostForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces post forbidden response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces post forbidden response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces post forbidden response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces post forbidden response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces post forbidden response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 networks network interfaces post forbidden response +func (o *V1NetworksNetworkInterfacesPostForbidden) Code() int { + return 403 +} + +func (o *V1NetworksNetworkInterfacesPostForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostForbidden %s", 403, payload) +} + +func (o *V1NetworksNetworkInterfacesPostForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostForbidden %s", 403, payload) +} + +func (o *V1NetworksNetworkInterfacesPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesPostNotFound creates a V1NetworksNetworkInterfacesPostNotFound with default headers values +func NewV1NetworksNetworkInterfacesPostNotFound() *V1NetworksNetworkInterfacesPostNotFound { + return &V1NetworksNetworkInterfacesPostNotFound{} +} + +/* +V1NetworksNetworkInterfacesPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworksNetworkInterfacesPostNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces post not found response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces post not found response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces post not found response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces post not found response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces post not found response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 networks network interfaces post not found response +func (o *V1NetworksNetworkInterfacesPostNotFound) Code() int { + return 404 +} + +func (o *V1NetworksNetworkInterfacesPostNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostNotFound %s", 404, payload) +} + +func (o *V1NetworksNetworkInterfacesPostNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostNotFound %s", 404, payload) +} + +func (o *V1NetworksNetworkInterfacesPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesPostConflict creates a V1NetworksNetworkInterfacesPostConflict with default headers values +func NewV1NetworksNetworkInterfacesPostConflict() *V1NetworksNetworkInterfacesPostConflict { + return &V1NetworksNetworkInterfacesPostConflict{} +} + +/* +V1NetworksNetworkInterfacesPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworksNetworkInterfacesPostConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces post conflict response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces post conflict response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces post conflict response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces post conflict response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces post conflict response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 networks network interfaces post conflict response +func (o *V1NetworksNetworkInterfacesPostConflict) Code() int { + return 409 +} + +func (o *V1NetworksNetworkInterfacesPostConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostConflict %s", 409, payload) +} + +func (o *V1NetworksNetworkInterfacesPostConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostConflict %s", 409, payload) +} + +func (o *V1NetworksNetworkInterfacesPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesPostUnprocessableEntity creates a V1NetworksNetworkInterfacesPostUnprocessableEntity with default headers values +func NewV1NetworksNetworkInterfacesPostUnprocessableEntity() *V1NetworksNetworkInterfacesPostUnprocessableEntity { + return &V1NetworksNetworkInterfacesPostUnprocessableEntity{} +} + +/* +V1NetworksNetworkInterfacesPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type V1NetworksNetworkInterfacesPostUnprocessableEntity struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces post unprocessable entity response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces post unprocessable entity response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces post unprocessable entity response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces post unprocessable entity response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces post unprocessable entity response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the v1 networks network interfaces post unprocessable entity response +func (o *V1NetworksNetworkInterfacesPostUnprocessableEntity) Code() int { + return 422 +} + +func (o *V1NetworksNetworkInterfacesPostUnprocessableEntity) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworksNetworkInterfacesPostUnprocessableEntity) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworksNetworkInterfacesPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesPostInternalServerError creates a V1NetworksNetworkInterfacesPostInternalServerError with default headers values +func NewV1NetworksNetworkInterfacesPostInternalServerError() *V1NetworksNetworkInterfacesPostInternalServerError { + return &V1NetworksNetworkInterfacesPostInternalServerError{} +} + +/* +V1NetworksNetworkInterfacesPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworksNetworkInterfacesPostInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces post internal server error response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces post internal server error response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces post internal server error response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 networks network interfaces post internal server error response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 networks network interfaces post internal server error response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 networks network interfaces post internal server error response +func (o *V1NetworksNetworkInterfacesPostInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworksNetworkInterfacesPostInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworksNetworkInterfacesPostInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/networks/{network_id}/network-interfaces][%d] v1NetworksNetworkInterfacesPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworksNetworkInterfacesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/networks/v1_networks_network_interfaces_put_parameters.go b/power/client/networks/v1_networks_network_interfaces_put_parameters.go new file mode 100644 index 00000000..77e8d3d2 --- /dev/null +++ b/power/client/networks/v1_networks_network_interfaces_put_parameters.go @@ -0,0 +1,197 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// NewV1NetworksNetworkInterfacesPutParams creates a new V1NetworksNetworkInterfacesPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworksNetworkInterfacesPutParams() *V1NetworksNetworkInterfacesPutParams { + return &V1NetworksNetworkInterfacesPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworksNetworkInterfacesPutParamsWithTimeout creates a new V1NetworksNetworkInterfacesPutParams object +// with the ability to set a timeout on a request. +func NewV1NetworksNetworkInterfacesPutParamsWithTimeout(timeout time.Duration) *V1NetworksNetworkInterfacesPutParams { + return &V1NetworksNetworkInterfacesPutParams{ + timeout: timeout, + } +} + +// NewV1NetworksNetworkInterfacesPutParamsWithContext creates a new V1NetworksNetworkInterfacesPutParams object +// with the ability to set a context for a request. +func NewV1NetworksNetworkInterfacesPutParamsWithContext(ctx context.Context) *V1NetworksNetworkInterfacesPutParams { + return &V1NetworksNetworkInterfacesPutParams{ + Context: ctx, + } +} + +// NewV1NetworksNetworkInterfacesPutParamsWithHTTPClient creates a new V1NetworksNetworkInterfacesPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworksNetworkInterfacesPutParamsWithHTTPClient(client *http.Client) *V1NetworksNetworkInterfacesPutParams { + return &V1NetworksNetworkInterfacesPutParams{ + HTTPClient: client, + } +} + +/* +V1NetworksNetworkInterfacesPutParams contains all the parameters to send to the API endpoint + + for the v1 networks network interfaces put operation. + + Typically these are written to a http.Request. +*/ +type V1NetworksNetworkInterfacesPutParams struct { + + /* Body. + + Parameters for updating a Network Interface + */ + Body *models.NetworkInterfaceUpdate + + /* NetworkID. + + Network ID + */ + NetworkID string + + /* NetworkInterfaceID. + + Network Interface ID + */ + NetworkInterfaceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 networks network interfaces put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworksNetworkInterfacesPutParams) WithDefaults() *V1NetworksNetworkInterfacesPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 networks network interfaces put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworksNetworkInterfacesPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) WithTimeout(timeout time.Duration) *V1NetworksNetworkInterfacesPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) WithContext(ctx context.Context) *V1NetworksNetworkInterfacesPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) WithHTTPClient(client *http.Client) *V1NetworksNetworkInterfacesPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) WithBody(body *models.NetworkInterfaceUpdate) *V1NetworksNetworkInterfacesPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) SetBody(body *models.NetworkInterfaceUpdate) { + o.Body = body +} + +// WithNetworkID adds the networkID to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) WithNetworkID(networkID string) *V1NetworksNetworkInterfacesPutParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WithNetworkInterfaceID adds the networkInterfaceID to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) WithNetworkInterfaceID(networkInterfaceID string) *V1NetworksNetworkInterfacesPutParams { + o.SetNetworkInterfaceID(networkInterfaceID) + return o +} + +// SetNetworkInterfaceID adds the networkInterfaceId to the v1 networks network interfaces put params +func (o *V1NetworksNetworkInterfacesPutParams) SetNetworkInterfaceID(networkInterfaceID string) { + o.NetworkInterfaceID = networkInterfaceID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworksNetworkInterfacesPutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + // path param network_interface_id + if err := r.SetPathParam("network_interface_id", o.NetworkInterfaceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/networks/v1_networks_network_interfaces_put_responses.go b/power/client/networks/v1_networks_network_interfaces_put_responses.go new file mode 100644 index 00000000..81898478 --- /dev/null +++ b/power/client/networks/v1_networks_network_interfaces_put_responses.go @@ -0,0 +1,562 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworksNetworkInterfacesPutReader is a Reader for the V1NetworksNetworkInterfacesPut structure. +type V1NetworksNetworkInterfacesPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworksNetworkInterfacesPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworksNetworkInterfacesPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworksNetworkInterfacesPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworksNetworkInterfacesPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworksNetworkInterfacesPutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworksNetworkInterfacesPutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewV1NetworksNetworkInterfacesPutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworksNetworkInterfacesPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}] v1.networks.network-interfaces.put", response, response.Code()) + } +} + +// NewV1NetworksNetworkInterfacesPutOK creates a V1NetworksNetworkInterfacesPutOK with default headers values +func NewV1NetworksNetworkInterfacesPutOK() *V1NetworksNetworkInterfacesPutOK { + return &V1NetworksNetworkInterfacesPutOK{} +} + +/* +V1NetworksNetworkInterfacesPutOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworksNetworkInterfacesPutOK struct { + Payload *models.NetworkInterface +} + +// IsSuccess returns true when this v1 networks network interfaces put o k response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPutOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 networks network interfaces put o k response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPutOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces put o k response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPutOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 networks network interfaces put o k response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPutOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces put o k response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPutOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 networks network interfaces put o k response +func (o *V1NetworksNetworkInterfacesPutOK) Code() int { + return 200 +} + +func (o *V1NetworksNetworkInterfacesPutOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutOK %s", 200, payload) +} + +func (o *V1NetworksNetworkInterfacesPutOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutOK %s", 200, payload) +} + +func (o *V1NetworksNetworkInterfacesPutOK) GetPayload() *models.NetworkInterface { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkInterface) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesPutBadRequest creates a V1NetworksNetworkInterfacesPutBadRequest with default headers values +func NewV1NetworksNetworkInterfacesPutBadRequest() *V1NetworksNetworkInterfacesPutBadRequest { + return &V1NetworksNetworkInterfacesPutBadRequest{} +} + +/* +V1NetworksNetworkInterfacesPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworksNetworkInterfacesPutBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces put bad request response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPutBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces put bad request response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPutBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces put bad request response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPutBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces put bad request response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPutBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces put bad request response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPutBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 networks network interfaces put bad request response +func (o *V1NetworksNetworkInterfacesPutBadRequest) Code() int { + return 400 +} + +func (o *V1NetworksNetworkInterfacesPutBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutBadRequest %s", 400, payload) +} + +func (o *V1NetworksNetworkInterfacesPutBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutBadRequest %s", 400, payload) +} + +func (o *V1NetworksNetworkInterfacesPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesPutUnauthorized creates a V1NetworksNetworkInterfacesPutUnauthorized with default headers values +func NewV1NetworksNetworkInterfacesPutUnauthorized() *V1NetworksNetworkInterfacesPutUnauthorized { + return &V1NetworksNetworkInterfacesPutUnauthorized{} +} + +/* +V1NetworksNetworkInterfacesPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworksNetworkInterfacesPutUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces put unauthorized response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPutUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces put unauthorized response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPutUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces put unauthorized response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPutUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces put unauthorized response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPutUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces put unauthorized response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPutUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 networks network interfaces put unauthorized response +func (o *V1NetworksNetworkInterfacesPutUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworksNetworkInterfacesPutUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutUnauthorized %s", 401, payload) +} + +func (o *V1NetworksNetworkInterfacesPutUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutUnauthorized %s", 401, payload) +} + +func (o *V1NetworksNetworkInterfacesPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesPutForbidden creates a V1NetworksNetworkInterfacesPutForbidden with default headers values +func NewV1NetworksNetworkInterfacesPutForbidden() *V1NetworksNetworkInterfacesPutForbidden { + return &V1NetworksNetworkInterfacesPutForbidden{} +} + +/* +V1NetworksNetworkInterfacesPutForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworksNetworkInterfacesPutForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces put forbidden response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPutForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces put forbidden response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPutForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces put forbidden response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPutForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces put forbidden response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPutForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces put forbidden response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPutForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 networks network interfaces put forbidden response +func (o *V1NetworksNetworkInterfacesPutForbidden) Code() int { + return 403 +} + +func (o *V1NetworksNetworkInterfacesPutForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutForbidden %s", 403, payload) +} + +func (o *V1NetworksNetworkInterfacesPutForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutForbidden %s", 403, payload) +} + +func (o *V1NetworksNetworkInterfacesPutForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPutForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesPutNotFound creates a V1NetworksNetworkInterfacesPutNotFound with default headers values +func NewV1NetworksNetworkInterfacesPutNotFound() *V1NetworksNetworkInterfacesPutNotFound { + return &V1NetworksNetworkInterfacesPutNotFound{} +} + +/* +V1NetworksNetworkInterfacesPutNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworksNetworkInterfacesPutNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces put not found response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPutNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces put not found response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPutNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces put not found response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPutNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces put not found response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPutNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces put not found response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPutNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 networks network interfaces put not found response +func (o *V1NetworksNetworkInterfacesPutNotFound) Code() int { + return 404 +} + +func (o *V1NetworksNetworkInterfacesPutNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutNotFound %s", 404, payload) +} + +func (o *V1NetworksNetworkInterfacesPutNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutNotFound %s", 404, payload) +} + +func (o *V1NetworksNetworkInterfacesPutNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPutNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesPutUnprocessableEntity creates a V1NetworksNetworkInterfacesPutUnprocessableEntity with default headers values +func NewV1NetworksNetworkInterfacesPutUnprocessableEntity() *V1NetworksNetworkInterfacesPutUnprocessableEntity { + return &V1NetworksNetworkInterfacesPutUnprocessableEntity{} +} + +/* +V1NetworksNetworkInterfacesPutUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type V1NetworksNetworkInterfacesPutUnprocessableEntity struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces put unprocessable entity response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPutUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces put unprocessable entity response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPutUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces put unprocessable entity response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPutUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 networks network interfaces put unprocessable entity response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPutUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 networks network interfaces put unprocessable entity response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPutUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the v1 networks network interfaces put unprocessable entity response +func (o *V1NetworksNetworkInterfacesPutUnprocessableEntity) Code() int { + return 422 +} + +func (o *V1NetworksNetworkInterfacesPutUnprocessableEntity) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworksNetworkInterfacesPutUnprocessableEntity) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworksNetworkInterfacesPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworksNetworkInterfacesPutInternalServerError creates a V1NetworksNetworkInterfacesPutInternalServerError with default headers values +func NewV1NetworksNetworkInterfacesPutInternalServerError() *V1NetworksNetworkInterfacesPutInternalServerError { + return &V1NetworksNetworkInterfacesPutInternalServerError{} +} + +/* +V1NetworksNetworkInterfacesPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworksNetworkInterfacesPutInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 networks network interfaces put internal server error response has a 2xx status code +func (o *V1NetworksNetworkInterfacesPutInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 networks network interfaces put internal server error response has a 3xx status code +func (o *V1NetworksNetworkInterfacesPutInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 networks network interfaces put internal server error response has a 4xx status code +func (o *V1NetworksNetworkInterfacesPutInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 networks network interfaces put internal server error response has a 5xx status code +func (o *V1NetworksNetworkInterfacesPutInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 networks network interfaces put internal server error response a status code equal to that given +func (o *V1NetworksNetworkInterfacesPutInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 networks network interfaces put internal server error response +func (o *V1NetworksNetworkInterfacesPutInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworksNetworkInterfacesPutInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutInternalServerError %s", 500, payload) +} + +func (o *V1NetworksNetworkInterfacesPutInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/networks/{network_id}/network-interfaces/{network_interface_id}][%d] v1NetworksNetworkInterfacesPutInternalServerError %s", 500, payload) +} + +func (o *V1NetworksNetworkInterfacesPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworksNetworkInterfacesPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/power_iaas_api_client.go b/power/client/power_iaas_api_client.go index 43c7c298..3c14cb10 100644 --- a/power/client/power_iaas_api_client.go +++ b/power/client/power_iaas_api_client.go @@ -21,6 +21,7 @@ import ( "github.com/IBM-Cloud/power-go-client/power/client/internal_power_v_s_locations" "github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions" "github.com/IBM-Cloud/power-go-client/power/client/internal_transit_gateway" + "github.com/IBM-Cloud/power-go-client/power/client/networks" "github.com/IBM-Cloud/power-go-client/power/client/open_stacks" "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections" "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_disaster_recovery" @@ -110,6 +111,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *PowerIaasA cli.InternalPowervsLocations = internal_power_v_s_locations.New(transport, formats) cli.InternalStorageRegions = internal_storage_regions.New(transport, formats) cli.InternalTransitGateway = internal_transit_gateway.New(transport, formats) + cli.Networks = networks.New(transport, formats) cli.OpenStacks = open_stacks.New(transport, formats) cli.PCloudCloudConnections = p_cloud_cloud_connections.New(transport, formats) cli.PCloudDisasterRecovery = p_cloud_disaster_recovery.New(transport, formats) @@ -210,6 +212,8 @@ type PowerIaasAPI struct { InternalTransitGateway internal_transit_gateway.ClientService + Networks networks.ClientService + OpenStacks open_stacks.ClientService PCloudCloudConnections p_cloud_cloud_connections.ClientService @@ -295,6 +299,7 @@ func (c *PowerIaasAPI) SetTransport(transport runtime.ClientTransport) { c.InternalPowervsLocations.SetTransport(transport) c.InternalStorageRegions.SetTransport(transport) c.InternalTransitGateway.SetTransport(transport) + c.Networks.SetTransport(transport) c.OpenStacks.SetTransport(transport) c.PCloudCloudConnections.SetTransport(transport) c.PCloudDisasterRecovery.SetTransport(transport) diff --git a/power/models/network_interface.go b/power/models/network_interface.go new file mode 100644 index 00000000..4c4792b9 --- /dev/null +++ b/power/models/network_interface.go @@ -0,0 +1,258 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkInterface network interface +// +// swagger:model NetworkInterface +type NetworkInterface struct { + + // The Network Interface's crn + // Required: true + Crn *string `json:"crn"` + + // The unique Network Interface ID + // Required: true + ID *string `json:"id"` + + // instance + Instance *NetworkInterfaceInstance `json:"instance,omitempty"` + + // The ip address of this Network Interface + // Required: true + IPAddress *string `json:"ipAddress"` + + // The mac address of the Network Interface + // Required: true + MacAddress *string `json:"macAddress"` + + // Name of the Network Interface (not unique or indexable) + // Required: true + Name *string `json:"name"` + + // ID of the Network Security Group the network interface will be added to + NetworkSecurityGroupID string `json:"networkSecurityGroupID,omitempty"` + + // The status of the network address group + // Required: true + Status *string `json:"status"` + + // The user tags associated with this resource. + UserTags []string `json:"userTags,omitempty"` +} + +// Validate validates this network interface +func (m *NetworkInterface) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateInstance(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIPAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMacAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkInterface) validateCrn(formats strfmt.Registry) error { + + if err := validate.Required("crn", "body", m.Crn); err != nil { + return err + } + + return nil +} + +func (m *NetworkInterface) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *NetworkInterface) validateInstance(formats strfmt.Registry) error { + if swag.IsZero(m.Instance) { // not required + return nil + } + + if m.Instance != nil { + if err := m.Instance.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("instance") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("instance") + } + return err + } + } + + return nil +} + +func (m *NetworkInterface) validateIPAddress(formats strfmt.Registry) error { + + if err := validate.Required("ipAddress", "body", m.IPAddress); err != nil { + return err + } + + return nil +} + +func (m *NetworkInterface) validateMacAddress(formats strfmt.Registry) error { + + if err := validate.Required("macAddress", "body", m.MacAddress); err != nil { + return err + } + + return nil +} + +func (m *NetworkInterface) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *NetworkInterface) validateStatus(formats strfmt.Registry) error { + + if err := validate.Required("status", "body", m.Status); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this network interface based on the context it is used +func (m *NetworkInterface) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateInstance(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkInterface) contextValidateInstance(ctx context.Context, formats strfmt.Registry) error { + + if m.Instance != nil { + + if swag.IsZero(m.Instance) { // not required + return nil + } + + if err := m.Instance.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("instance") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("instance") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkInterface) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkInterface) UnmarshalBinary(b []byte) error { + var res NetworkInterface + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// NetworkInterfaceInstance The attached instance to this Network Interface +// +// swagger:model NetworkInterfaceInstance +type NetworkInterfaceInstance struct { + + // Link to instance resource + Href string `json:"href,omitempty"` + + // The attached instance ID + InstanceID string `json:"instanceID,omitempty"` +} + +// Validate validates this network interface instance +func (m *NetworkInterfaceInstance) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this network interface instance based on context it is used +func (m *NetworkInterfaceInstance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkInterfaceInstance) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkInterfaceInstance) UnmarshalBinary(b []byte) error { + var res NetworkInterfaceInstance + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_interface_create.go b/power/models/network_interface_create.go new file mode 100644 index 00000000..fab1c643 --- /dev/null +++ b/power/models/network_interface_create.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NetworkInterfaceCreate network interface create +// +// swagger:model NetworkInterfaceCreate +type NetworkInterfaceCreate struct { + + // The requested IP address of this Network Interface + IPAddress string `json:"ipAddress,omitempty"` + + // Name of the Network Interface + Name string `json:"name,omitempty"` + + // The user tags associated with this resource. + UserTags []string `json:"userTags"` +} + +// Validate validates this network interface create +func (m *NetworkInterfaceCreate) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this network interface create based on context it is used +func (m *NetworkInterfaceCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkInterfaceCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkInterfaceCreate) UnmarshalBinary(b []byte) error { + var res NetworkInterfaceCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_interface_update.go b/power/models/network_interface_update.go new file mode 100644 index 00000000..c6c981e0 --- /dev/null +++ b/power/models/network_interface_update.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NetworkInterfaceUpdate network interface update +// +// swagger:model NetworkInterfaceUpdate +type NetworkInterfaceUpdate struct { + + // If supplied populated it attaches to the InstanceID, if empty detaches from InstanceID + InstanceID *string `json:"instanceID,omitempty"` + + // Name of the Network Interface + Name *string `json:"name,omitempty"` +} + +// Validate validates this network interface update +func (m *NetworkInterfaceUpdate) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this network interface update based on context it is used +func (m *NetworkInterfaceUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkInterfaceUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkInterfaceUpdate) UnmarshalBinary(b []byte) error { + var res NetworkInterfaceUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_interfaces.go b/power/models/network_interfaces.go new file mode 100644 index 00000000..a9ec76a7 --- /dev/null +++ b/power/models/network_interfaces.go @@ -0,0 +1,124 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkInterfaces network interfaces +// +// swagger:model NetworkInterfaces +type NetworkInterfaces struct { + + // Network Interfaces + // Required: true + Interfaces []*NetworkInterface `json:"interfaces"` +} + +// Validate validates this network interfaces +func (m *NetworkInterfaces) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateInterfaces(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkInterfaces) validateInterfaces(formats strfmt.Registry) error { + + if err := validate.Required("interfaces", "body", m.Interfaces); err != nil { + return err + } + + for i := 0; i < len(m.Interfaces); i++ { + if swag.IsZero(m.Interfaces[i]) { // not required + continue + } + + if m.Interfaces[i] != nil { + if err := m.Interfaces[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("interfaces" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("interfaces" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this network interfaces based on the context it is used +func (m *NetworkInterfaces) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateInterfaces(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkInterfaces) contextValidateInterfaces(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Interfaces); i++ { + + if m.Interfaces[i] != nil { + + if swag.IsZero(m.Interfaces[i]) { // not required + return nil + } + + if err := m.Interfaces[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("interfaces" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("interfaces" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkInterfaces) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkInterfaces) UnmarshalBinary(b []byte) error { + var res NetworkInterfaces + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} From 0ce30af5948875528431f6f35b016d9966b58d7a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 13:29:46 -0500 Subject: [PATCH 008/123] Bump github.com/go-openapi/errors from 0.21.0 to 0.22.0 (#355) Bumps [github.com/go-openapi/errors](https://github.com/go-openapi/errors) from 0.21.0 to 0.22.0. - [Commits](https://github.com/go-openapi/errors/compare/v0.21.0...v0.22.0) --- updated-dependencies: - dependency-name: github.com/go-openapi/errors dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 5c3ed7b1..562dd5fb 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/IBM/go-sdk-core/v5 v5.15.3 github.com/IBM/platform-services-go-sdk v0.59.1 github.com/apparentlymart/go-cidr v1.1.0 - github.com/go-openapi/errors v0.21.0 + github.com/go-openapi/errors v0.22.0 github.com/go-openapi/runtime v0.26.0 github.com/go-openapi/strfmt v0.22.0 github.com/go-openapi/swag v0.22.5 diff --git a/go.sum b/go.sum index f5ddf185..1a841551 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-openapi/analysis v0.21.5 h1:3tHfEBh6Ia8eKc4M7khOGjPOAlWKJ10d877Cr9teujI= github.com/go-openapi/analysis v0.21.5/go.mod h1:25YcZosX9Lwz2wBsrFrrsL8bmjjXdlyP6zsr2AMy29M= -github.com/go-openapi/errors v0.21.0 h1:FhChC/duCnfoLj1gZ0BgaBmzhJC2SL/sJr8a2vAobSY= -github.com/go-openapi/errors v0.21.0/go.mod h1:jxNTMUxRCKj65yb/okJGEtahVd7uvWnuWfj53bse4ho= +github.com/go-openapi/errors v0.22.0 h1:c4xY/OLxUBSTiepAg3j/MHuAv5mJhnf53LLMWFB+u/w= +github.com/go-openapi/errors v0.22.0/go.mod h1:J3DmZScxCDufmIMsdOuDHxJbdOGC0xtUynjIx092vXE= github.com/go-openapi/jsonpointer v0.20.1 h1:MkK4VEIEZMj4wT9PmjaUmGflVBr9nvud4Q4UVFbDoBE= github.com/go-openapi/jsonpointer v0.20.1/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= github.com/go-openapi/jsonreference v0.20.3 h1:EjGcjTW8pD1mRis6+w/gmoBdqv5+RbE9B85D1NgDOVQ= From 71c87920915f27e10caa23d337fd2f9f2f19ea65 Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Mon, 30 Sep 2024 13:50:04 -0500 Subject: [PATCH 009/123] Revert "Bump github.com/go-openapi/errors from 0.21.0 to 0.22.0 (#355)" (#475) This reverts commit 0ce30af5948875528431f6f35b016d9966b58d7a. --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 562dd5fb..5c3ed7b1 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/IBM/go-sdk-core/v5 v5.15.3 github.com/IBM/platform-services-go-sdk v0.59.1 github.com/apparentlymart/go-cidr v1.1.0 - github.com/go-openapi/errors v0.22.0 + github.com/go-openapi/errors v0.21.0 github.com/go-openapi/runtime v0.26.0 github.com/go-openapi/strfmt v0.22.0 github.com/go-openapi/swag v0.22.5 diff --git a/go.sum b/go.sum index 1a841551..f5ddf185 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-openapi/analysis v0.21.5 h1:3tHfEBh6Ia8eKc4M7khOGjPOAlWKJ10d877Cr9teujI= github.com/go-openapi/analysis v0.21.5/go.mod h1:25YcZosX9Lwz2wBsrFrrsL8bmjjXdlyP6zsr2AMy29M= -github.com/go-openapi/errors v0.22.0 h1:c4xY/OLxUBSTiepAg3j/MHuAv5mJhnf53LLMWFB+u/w= -github.com/go-openapi/errors v0.22.0/go.mod h1:J3DmZScxCDufmIMsdOuDHxJbdOGC0xtUynjIx092vXE= +github.com/go-openapi/errors v0.21.0 h1:FhChC/duCnfoLj1gZ0BgaBmzhJC2SL/sJr8a2vAobSY= +github.com/go-openapi/errors v0.21.0/go.mod h1:jxNTMUxRCKj65yb/okJGEtahVd7uvWnuWfj53bse4ho= github.com/go-openapi/jsonpointer v0.20.1 h1:MkK4VEIEZMj4wT9PmjaUmGflVBr9nvud4Q4UVFbDoBE= github.com/go-openapi/jsonpointer v0.20.1/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= github.com/go-openapi/jsonreference v0.20.3 h1:EjGcjTW8pD1mRis6+w/gmoBdqv5+RbE9B85D1NgDOVQ= From 53ca6b4b9bc20f5ae33a97d93498c4e9f550c468 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 14:20:45 +0000 Subject: [PATCH 010/123] Bump github.com/IBM/platform-services-go-sdk from 0.59.1 to 0.69.2 (#482) --- go.mod | 14 ++++++------- go.sum | 66 +++++++++++++--------------------------------------------- 2 files changed, 20 insertions(+), 60 deletions(-) diff --git a/go.mod b/go.mod index 5c3ed7b1..e7e8d8cb 100644 --- a/go.mod +++ b/go.mod @@ -3,12 +3,12 @@ module github.com/IBM-Cloud/power-go-client go 1.22.0 require ( - github.com/IBM/go-sdk-core/v5 v5.15.3 - github.com/IBM/platform-services-go-sdk v0.59.1 + github.com/IBM/go-sdk-core/v5 v5.17.5 + github.com/IBM/platform-services-go-sdk v0.69.2 github.com/apparentlymart/go-cidr v1.1.0 github.com/go-openapi/errors v0.21.0 github.com/go-openapi/runtime v0.26.0 - github.com/go-openapi/strfmt v0.22.0 + github.com/go-openapi/strfmt v0.22.1 github.com/go-openapi/swag v0.22.5 github.com/go-openapi/validate v0.22.4 github.com/stretchr/testify v1.8.4 @@ -27,20 +27,18 @@ require ( github.com/go-openapi/spec v0.20.12 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.17.0 // indirect - github.com/google/go-cmp v0.6.0 // indirect + github.com/go-playground/validator/v10 v10.19.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-retryablehttp v0.7.7 // indirect github.com/josharian/intern v1.0.0 // indirect - github.com/leodido/go-urn v1.3.0 // indirect + github.com/leodido/go-urn v1.4.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/oklog/ulid v1.3.1 // indirect - github.com/onsi/gomega v1.29.0 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.mongodb.org/mongo-driver v1.13.1 // indirect + go.mongodb.org/mongo-driver v1.14.0 // indirect go.opentelemetry.io/otel v1.14.0 // indirect go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/crypto v0.21.0 // indirect diff --git a/go.sum b/go.sum index f5ddf185..497be505 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ -github.com/IBM/go-sdk-core/v5 v5.15.3 h1:yBSSYLuQSO9Ip+j3mONsTcymoYQyxarQ6rh3aU9cVt8= -github.com/IBM/go-sdk-core/v5 v5.15.3/go.mod h1:ee+AZaB15yUwZigJdRCwZZ3u7HIvEQzxNUdxVpnJHY8= -github.com/IBM/platform-services-go-sdk v0.59.1 h1:qyXJX1sNgbDDrXb5M9LrjMjCm2w9dkSEtBGAfZJlT0Y= -github.com/IBM/platform-services-go-sdk v0.59.1/go.mod h1:cLKLn9Bd1YcTM/micLQmikjZDDQvRgfhdAHKOeulILg= +github.com/IBM/go-sdk-core/v5 v5.17.5 h1:AjGC7xNee5tgDIjndekBDW5AbypdERHSgib3EZ1KNsA= +github.com/IBM/go-sdk-core/v5 v5.17.5/go.mod h1:KsAAI7eStAWwQa4F96MLy+whYSh39JzNjklZRbN/8ns= +github.com/IBM/platform-services-go-sdk v0.69.2 h1:8XNI8rBZShutuybFN5v8BsWlrdUa1eF0L6nOS+lDXmI= +github.com/IBM/platform-services-go-sdk v0.69.2/go.mod h1:ZP3zUDxR1qRdUqzFdnJOlQN0QpVYol2eOUCv4uk03Jc= github.com/apparentlymart/go-cidr v1.1.0 h1:2mAhrMoF+nhXqxTzSZMUzDHkLjmIHC+Zzn4tdgBZjnU= github.com/apparentlymart/go-cidr v1.1.0/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= @@ -34,8 +34,8 @@ github.com/go-openapi/runtime v0.26.0 h1:HYOFtG00FM1UvqrcxbEJg/SwvDRvYLQKGhw2zaQ github.com/go-openapi/runtime v0.26.0/go.mod h1:QgRGeZwrUcSHdeh4Ka9Glvo0ug1LC5WyE+EV88plZrQ= github.com/go-openapi/spec v0.20.12 h1:cgSLbrsmziAP2iais+Vz7kSazwZ8rsUZd6TUzdDgkVI= github.com/go-openapi/spec v0.20.12/go.mod h1:iSCgnBcwbMW9SfzJb8iYynXvcY6C/QFrI7otzF7xGM4= -github.com/go-openapi/strfmt v0.22.0 h1:Ew9PnEYc246TwrEspvBdDHS4BVKXy/AOVsfqGDgAcaI= -github.com/go-openapi/strfmt v0.22.0/go.mod h1:HzJ9kokGIju3/K6ap8jL+OlGAbjpSv27135Yr9OivU4= +github.com/go-openapi/strfmt v0.22.1 h1:5Ky8cybT4576C6Ffc+8gYji/wRXCo6Ozm8RaWjPI6jc= +github.com/go-openapi/strfmt v0.22.1/go.mod h1:OfVoytIXJasDkkGvkb1Cceb3BPyMOwk1FgmyyEw7NYg= github.com/go-openapi/swag v0.22.5 h1:fVS63IE3M0lsuWRzuom3RLwUMVI2peDH01s6M70ugys= github.com/go-openapi/swag v0.22.5/go.mod h1:Gl91UqO+btAM0plGGxHqJcQZ1ZTy6jbmridBTsDy8A0= github.com/go-openapi/validate v0.22.4 h1:5v3jmMyIPKTR8Lv9syBAIRxG6lY0RqeBPB1LKEijzk8= @@ -46,10 +46,8 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.17.0 h1:SmVVlfAOtlZncTxRuinDPomC2DkXJ4E5T9gDA0AIH74= -github.com/go-playground/validator/v10 v10.17.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/go-playground/validator/v10 v10.19.0 h1:ol+5Fu+cSq9JD7SoSqe04GMI92cbn0+wvQ3bZ8b/AU4= +github.com/go-playground/validator/v10 v10.19.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -62,13 +60,12 @@ github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISH github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= -github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/leodido/go-urn v1.3.0 h1:jX8FDLfW4ThVXctBNZ+3cIWnCSnrACDV73r76dy0aQQ= -github.com/leodido/go-urn v1.3.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= +github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= +github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= @@ -77,15 +74,14 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg= -github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/onsi/gomega v1.31.1 h1:KYppCUK+bUgAZwHOu7EXVBKyQA6ILvOESHkn/tgoqvo= +github.com/onsi/gomega v1.31.1/go.mod h1:y40C95dwAD1Nz36SsEnxvfFe8FFfNxzI5eJ0EYGyAy0= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -96,56 +92,22 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= -github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= -github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.mongodb.org/mongo-driver v1.13.1 h1:YIc7HTYsKndGK4RFzJ3covLz1byri52x0IoMB0Pt/vk= -go.mongodb.org/mongo-driver v1.13.1/go.mod h1:wcDf1JBCXy2mOW0bWHwO/IOYqdca1MPCwDtFu/Z9+eo= +go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80= +go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU= go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvxGzY= go.opentelemetry.io/otel/sdk v1.14.0/go.mod h1:bwIC5TjrNG6QDCHNWvW4HLHtUQ4I+VQDsnjhvyZCALM= go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M= go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= From aeceda87f10e4bb2b11971b85c9a41e988c28b34 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 14:44:05 +0000 Subject: [PATCH 011/123] Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 (#478) --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index e7e8d8cb..2392b0d6 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/go-openapi/strfmt v0.22.1 github.com/go-openapi/swag v0.22.5 github.com/go-openapi/validate v0.22.4 - github.com/stretchr/testify v1.8.4 + github.com/stretchr/testify v1.9.0 ) require ( diff --git a/go.sum b/go.sum index 497be505..c7de941e 100644 --- a/go.sum +++ b/go.sum @@ -90,8 +90,8 @@ github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDN github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80= go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= From 3eb8e2250574b320013ca3a9ef5f7b11fa3a833d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 14:58:05 +0000 Subject: [PATCH 012/123] Bump github.com/go-openapi/errors from 0.21.0 to 0.22.0 (#477) --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2392b0d6..a970e248 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/IBM/go-sdk-core/v5 v5.17.5 github.com/IBM/platform-services-go-sdk v0.69.2 github.com/apparentlymart/go-cidr v1.1.0 - github.com/go-openapi/errors v0.21.0 + github.com/go-openapi/errors v0.22.0 github.com/go-openapi/runtime v0.26.0 github.com/go-openapi/strfmt v0.22.1 github.com/go-openapi/swag v0.22.5 diff --git a/go.sum b/go.sum index c7de941e..abbe0df9 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-openapi/analysis v0.21.5 h1:3tHfEBh6Ia8eKc4M7khOGjPOAlWKJ10d877Cr9teujI= github.com/go-openapi/analysis v0.21.5/go.mod h1:25YcZosX9Lwz2wBsrFrrsL8bmjjXdlyP6zsr2AMy29M= -github.com/go-openapi/errors v0.21.0 h1:FhChC/duCnfoLj1gZ0BgaBmzhJC2SL/sJr8a2vAobSY= -github.com/go-openapi/errors v0.21.0/go.mod h1:jxNTMUxRCKj65yb/okJGEtahVd7uvWnuWfj53bse4ho= +github.com/go-openapi/errors v0.22.0 h1:c4xY/OLxUBSTiepAg3j/MHuAv5mJhnf53LLMWFB+u/w= +github.com/go-openapi/errors v0.22.0/go.mod h1:J3DmZScxCDufmIMsdOuDHxJbdOGC0xtUynjIx092vXE= github.com/go-openapi/jsonpointer v0.20.1 h1:MkK4VEIEZMj4wT9PmjaUmGflVBr9nvud4Q4UVFbDoBE= github.com/go-openapi/jsonpointer v0.20.1/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= github.com/go-openapi/jsonreference v0.20.3 h1:EjGcjTW8pD1mRis6+w/gmoBdqv5+RbE9B85D1NgDOVQ= From 9e1f4e0d512f4b071096cf6762aa7d4be4dfa678 Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Fri, 1 Mar 2024 13:20:18 -0600 Subject: [PATCH 013/123] Add hostgroups (#326) * Add hostgroups * Fix build --- clients/instance/ibm-pi-hostgroups.go | 163 ++++++++++++++++++++++++++ examples/hostgroups/main.go | 62 ++++++++++ 2 files changed, 225 insertions(+) create mode 100644 clients/instance/ibm-pi-hostgroups.go create mode 100644 examples/hostgroups/main.go diff --git a/clients/instance/ibm-pi-hostgroups.go b/clients/instance/ibm-pi-hostgroups.go new file mode 100644 index 00000000..4ded770e --- /dev/null +++ b/clients/instance/ibm-pi-hostgroups.go @@ -0,0 +1,163 @@ +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/hostgroups" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPIHostgroupsClient +type IBMPIHostgroupsClient struct { + IBMPIClient +} + +// NewIBMPIHostgroupsClient +func NewIBMPHostgroupsClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPIHostgroupsClient { + return &IBMPIHostgroupsClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// Get All available hosts +func (f *IBMPIHostgroupsClient) GetAvailableHosts() (models.AvailableHostList, error) { + params := hostgroups.NewV1AvailableHostsParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut) + resp, err := f.session.Power.Hostgroups.V1AvailableHosts(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get available hosts for %s: %w", f.cloudInstanceID, err)) + } + + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get Available hosts") + } + return resp.Payload, nil +} + +// Get all Hostgroups +func (f *IBMPIHostgroupsClient) GetHostgroups() (models.HostgroupList, error) { + params := hostgroups.NewV1HostgroupsGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut) + resp, err := f.session.Power.Hostgroups.V1HostgroupsGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get Hostgroups for %s: %w", f.cloudInstanceID, err)) + } + + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get Hostgroups") + } + return resp.Payload, nil +} + +// Create a Hostgroup +func (f *IBMPIHostgroupsClient) CreateHostgroup(body *models.HostgroupCreate) (*models.Hostgroup, error) { + params := hostgroups.NewV1HostgroupsPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithBody(body) + resp, err := f.session.Power.Hostgroups.V1HostgroupsPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Create Hostgroup for %s: %w", f.cloudInstanceID, err)) + } + + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get Hostgroups") + } + return resp.Payload, nil +} + +// Update a Hostgroup +func (f *IBMPIHostgroupsClient) UpdateHostgroup(body *models.HostgroupShareOp, id string) (*models.Hostgroup, error) { + params := hostgroups.NewV1HostgroupsIDPutParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithBody(body).WithHostgroupID(id) + resp, err := f.session.Power.Hostgroups.V1HostgroupsIDPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Update Hostgroup for %s: %w", f.cloudInstanceID, err)) + } + + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Update Hostgroups") + } + return resp.Payload, nil +} + +// Get a Hostgroup +func (f *IBMPIHostgroupsClient) GetHostgroup(id string) (*models.Hostgroup, error) { + params := hostgroups.NewV1HostgroupsIDGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithHostgroupID(id) + resp, err := f.session.Power.Hostgroups.V1HostgroupsIDGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get Hostgroup %s for %s: %w", id, f.cloudInstanceID, err)) + } + + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get Hostgroup %s", id) + } + return resp.Payload, nil +} + +// Get All Hosts +func (f *IBMPIHostgroupsClient) GetHosts() (models.HostList, error) { + params := hostgroups.NewV1HostsGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut) + 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)) + } + + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get Hosts") + } + return resp.Payload, nil +} + +// Create a Host +func (f *IBMPIHostgroupsClient) CreateHost(body *models.HostCreate) (*models.Host, error) { + params := hostgroups.NewV1HostsPostParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithBody(body) + resp, err := f.session.Power.Hostgroups.V1HostsPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Create Hosts for %s: %w", f.cloudInstanceID, err)) + } + + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Create Hosts") + } + return resp.Payload, nil +} + +// Get a Host +func (f *IBMPIHostgroupsClient) GetHost(id string) (*models.Host, error) { + params := hostgroups.NewV1HostsIDGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithHostID(id) + 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)) + } + + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get Host %s", id) + } + return resp.Payload, nil +} + +// Update a Host +func (f *IBMPIHostgroupsClient) UpdateHost(body *models.HostPut, id string) (*models.Host, error) { + params := hostgroups.NewV1HostsIDPutParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithHostID(id).WithBody(body) + resp, err := f.session.Power.Hostgroups.V1HostsIDPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Update Host %s for %s: %w", id, f.cloudInstanceID, err)) + } + + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Update Host %s", id) + } + return resp.Payload, nil +} + +// Delete a Host +func (f *IBMPIHostgroupsClient) DeleteHost(id string) error { + params := hostgroups.NewV1HostsIDDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithHostID(id) + resp, err := f.session.Power.Hostgroups.V1HostsIDDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Delete Host %s for %s: %w", id, f.cloudInstanceID, err)) + } + + if resp == nil || resp.Payload == nil { + return fmt.Errorf("failed to Delete Host %s", id) + } + return nil +} diff --git a/examples/hostgroups/main.go b/examples/hostgroups/main.go new file mode 100644 index 00000000..d1ab8bfa --- /dev/null +++ b/examples/hostgroups/main.go @@ -0,0 +1,62 @@ +package main + +import ( + "context" + "log" + + v "github.com/IBM-Cloud/power-go-client/clients/instance" + ps "github.com/IBM-Cloud/power-go-client/ibmpisession" + "github.com/IBM/go-sdk-core/v5/core" +) + +func main() { + //session Inputs + // < IAM TOKEN > + // token := "" + apiKey := "" + region := " < REGION > " + zone := " < ZONE > " + accountID := " < ACCOUNT ID > " + url := region + ".power-iaas.test.cloud.ibm.com" + + // dr location inputs + piID := " < POWER INSTANCE ID > " + + // authenticator := &core.BearerTokenAuthenticator{ + // BearerToken: token, + // } + authenticator := &core.IamAuthenticator{ + ApiKey: apiKey, + // Uncomment for test environment + URL: "https://iam.test.cloud.ibm.com", + } + + // Create the session + options := &ps.IBMPIOptions{ + Authenticator: authenticator, + UserAccount: accountID, + Zone: zone, + URL: url, + Debug: true, + } + session, err := ps.NewIBMPISession(options) + if err != nil { + log.Fatal(err) + } + powerClient := v.NewIBMPHostgroupsClient(context.Background(), session, piID) + if err != nil { + log.Fatal(err) + } + + getAllAvailableHost, err := powerClient.GetAvailableHosts() + if err != nil { + log.Fatal(err) + } + log.Printf("***************[0]****************** %+v \n", getAllAvailableHost) + + getHostgroups, err := powerClient.GetHostgroups() + if err != nil { + log.Fatal(err) + } + log.Printf("***************[1]****************** %+v \n", getHostgroups) +} From 06936d8bfda9c9356028ed1d35e5182b9b1ba7c5 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Fri, 1 Mar 2024 13:31:05 -0600 Subject: [PATCH 014/123] Update swagger client and models to service-broker v1.140.0 (#337) * Generated Swagger client from service-broker commit f482db37dd0b38392de1f3aecdc2219212147830 * Fix build --------- Co-authored-by: michael kad --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d8f5e267..959c3c05 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v4 - + - name: Set up Go uses: actions/setup-go@v5 with: From 85d1a44d8893bd50d7d0e7791fa8c1c1413a1d35 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Wed, 13 Mar 2024 10:42:12 -0500 Subject: [PATCH 015/123] Update swagger client and models to service-broker v1.140.0 (#346) * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh * Update golangci-lint version and skip cache Signed-off-by: Yussuf Shaikh * Add branch to dependabot (#338) * Add branch to dependabot * Fix build * Generated Swagger client from service-broker commit 1db48bf5f665abf4e91c66d019aa231b913db3d9 --------- Signed-off-by: dependabot[bot] Signed-off-by: Yussuf Shaikh Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Yussuf Shaikh Co-authored-by: michaelkad <45772690+michaelkad@users.noreply.github.com> --- power/models/hostgroup_summary.go | 56 +++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 power/models/hostgroup_summary.go diff --git a/power/models/hostgroup_summary.go b/power/models/hostgroup_summary.go new file mode 100644 index 00000000..6112fd1d --- /dev/null +++ b/power/models/hostgroup_summary.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HostgroupSummary hostgroup summary +// +// swagger:model HostgroupSummary +type HostgroupSummary struct { + + // Whether the hostgroup is a primary or secondary hostgroup + Access string `json:"access,omitempty"` + + // Link to the hostgroup resource + Href string `json:"href,omitempty"` + + // Name of the hostgroup + Name string `json:"name,omitempty"` +} + +// Validate validates this hostgroup summary +func (m *HostgroupSummary) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this hostgroup summary based on context it is used +func (m *HostgroupSummary) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *HostgroupSummary) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HostgroupSummary) UnmarshalBinary(b []byte) error { + var res HostgroupSummary + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} From 0e828f65206d7f17946f27df657135c07aa0c610 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 02:29:29 +0000 Subject: [PATCH 016/123] Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] From 9b33f44d5ac95c17710519fcad2a96c801606b90 Mon Sep 17 00:00:00 2001 From: Yussuf Shaikh Date: Mon, 4 Mar 2024 09:35:42 +0530 Subject: [PATCH 017/123] Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh --- .github/workflows/go.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 959c3c05..a683f780 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,6 +20,11 @@ jobs: with: go-version: '1.22' + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.20' + - name: Lint uses: golangci/golangci-lint-action@v5 with: From da994e771e1e2602a6e36f7fc352d847652582a9 Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Mon, 4 Mar 2024 08:14:06 -0600 Subject: [PATCH 018/123] Add branch to dependabot (#338) * Add branch to dependabot * Fix build From c1c2bab32ef97fadf34424c27731eb89f3af850d Mon Sep 17 00:00:00 2001 From: Yussuf Shaikh Date: Wed, 13 Mar 2024 21:15:47 +0530 Subject: [PATCH 019/123] Remove duplicate go setup step (#348) --- .github/workflows/go.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index a683f780..959c3c05 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,11 +20,6 @@ jobs: with: go-version: '1.22' - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.20' - - name: Lint uses: golangci/golangci-lint-action@v5 with: From 0d6d27d3aabed154d7177bd8f1008e7f580d3847 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 02:29:29 +0000 Subject: [PATCH 020/123] Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] From 48f421e86b61faa378d0c031ada2854f357b96a2 Mon Sep 17 00:00:00 2001 From: Yussuf Shaikh Date: Mon, 4 Mar 2024 09:35:42 +0530 Subject: [PATCH 021/123] Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh --- .github/workflows/go.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 959c3c05..a683f780 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,6 +20,11 @@ jobs: with: go-version: '1.22' + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.20' + - name: Lint uses: golangci/golangci-lint-action@v5 with: From 19f366f4b41e7baaceb858c5c46e05914ff026ea Mon Sep 17 00:00:00 2001 From: Yussuf Shaikh Date: Mon, 4 Mar 2024 09:35:42 +0530 Subject: [PATCH 022/123] Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh --- .github/workflows/go.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index a683f780..959c3c05 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,11 +20,6 @@ jobs: with: go-version: '1.22' - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.20' - - name: Lint uses: golangci/golangci-lint-action@v5 with: From e9d13683924631fd2e8fb3721c7c63ceed23b11b Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Mon, 4 Mar 2024 08:14:06 -0600 Subject: [PATCH 023/123] Add branch to dependabot (#338) * Add branch to dependabot * Fix build --- .github/workflows/go.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 959c3c05..0b3a2d4c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -14,6 +14,10 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.20' - name: Set up Go uses: actions/setup-go@v5 From a750aef1f30c9bc1c69dea8e3d69ea4088b1e88d Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Fri, 1 Mar 2024 13:31:05 -0600 Subject: [PATCH 024/123] Update swagger client and models to service-broker v1.140.0 (#337) * Generated Swagger client from service-broker commit f482db37dd0b38392de1f3aecdc2219212147830 * Fix build --------- Co-authored-by: michael kad --- .github/workflows/go.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 0b3a2d4c..25d5fa66 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -14,6 +14,7 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Set up Go uses: actions/setup-go@v5 with: From 14b7f9a29e88ecf3014db05c0007edb2cd985a03 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Wed, 13 Mar 2024 10:42:12 -0500 Subject: [PATCH 025/123] Update swagger client and models to service-broker v1.140.0 (#346) * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh * Update golangci-lint version and skip cache Signed-off-by: Yussuf Shaikh * Add branch to dependabot (#338) * Add branch to dependabot * Fix build * Generated Swagger client from service-broker commit 1db48bf5f665abf4e91c66d019aa231b913db3d9 --------- Signed-off-by: dependabot[bot] Signed-off-by: Yussuf Shaikh Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Yussuf Shaikh Co-authored-by: michaelkad <45772690+michaelkad@users.noreply.github.com> --- .github/workflows/go.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 25d5fa66..959c3c05 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -14,11 +14,6 @@ jobs: steps: - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.20' - name: Set up Go uses: actions/setup-go@v5 From 7dbe60d58eaf4e0381056da895e216f5d9c7dbe4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 02:29:29 +0000 Subject: [PATCH 026/123] Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] From ecea2591830ae364c7634c5de0a02cbf6152d5c6 Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Mon, 4 Mar 2024 08:14:06 -0600 Subject: [PATCH 027/123] Add branch to dependabot (#338) * Add branch to dependabot * Fix build From a1c09d1e211f40695228e17f606e6baffce27551 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 02:29:29 +0000 Subject: [PATCH 028/123] Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] From 4cfa09723f907fe581e9d281d50d173cbd5f3695 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Fri, 1 Mar 2024 13:31:05 -0600 Subject: [PATCH 029/123] Update swagger client and models to service-broker v1.140.0 (#337) * Generated Swagger client from service-broker commit f482db37dd0b38392de1f3aecdc2219212147830 * Fix build --------- Co-authored-by: michael kad --- .github/workflows/go.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 959c3c05..25d5fa66 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -14,6 +14,11 @@ jobs: steps: - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.20' - name: Set up Go uses: actions/setup-go@v5 From 678babe04e902e549ba0f7d7f4e47ed4848cefd9 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Fri, 1 Mar 2024 13:32:01 -0600 Subject: [PATCH 030/123] Update swagger client and models to service-broker v1.140.0 (#336) * Generated Swagger client from service-broker commit 9786c4b2360ad846a1aa8f68f01fbb41979af3c9 * Fix build --------- Co-authored-by: michael kad --- .github/workflows/go.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 25d5fa66..959c3c05 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -14,11 +14,6 @@ jobs: steps: - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.20' - name: Set up Go uses: actions/setup-go@v5 From 259def9f3e63b2a8231a06287c24e87b6bd6e3b2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 02:29:29 +0000 Subject: [PATCH 031/123] Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] From 61a4503f394ce7e9b97c61b0d05c8e47ca60d315 Mon Sep 17 00:00:00 2001 From: Yussuf Shaikh Date: Mon, 4 Mar 2024 09:35:42 +0530 Subject: [PATCH 032/123] Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh --- .github/workflows/go.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 959c3c05..a683f780 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,6 +20,11 @@ jobs: with: go-version: '1.22' + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.20' + - name: Lint uses: golangci/golangci-lint-action@v5 with: From 5da54e1b2e82a51a8a7c10f9aa9bafa4044d2a30 Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Mon, 4 Mar 2024 08:14:06 -0600 Subject: [PATCH 033/123] Add branch to dependabot (#338) * Add branch to dependabot * Fix build From c89ffcfe4799cea286620b065788eae8a01dbd4c Mon Sep 17 00:00:00 2001 From: Yussuf Shaikh Date: Wed, 13 Mar 2024 21:15:47 +0530 Subject: [PATCH 034/123] Remove duplicate go setup step (#348) --- .github/workflows/go.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index a683f780..959c3c05 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,11 +20,6 @@ jobs: with: go-version: '1.22' - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.20' - - name: Lint uses: golangci/golangci-lint-action@v5 with: From 78eddcbd8425df6571248005decc8fc0c4556d93 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 02:29:29 +0000 Subject: [PATCH 035/123] Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] From 112a9d84e4335c7686eda530f18a1fdcbcc13118 Mon Sep 17 00:00:00 2001 From: Yussuf Shaikh Date: Mon, 4 Mar 2024 09:35:42 +0530 Subject: [PATCH 036/123] Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh --- .github/workflows/go.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 959c3c05..a683f780 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,6 +20,11 @@ jobs: with: go-version: '1.22' + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.20' + - name: Lint uses: golangci/golangci-lint-action@v5 with: From 07171165e14c628d75bf41bdee0edd59399a22ac Mon Sep 17 00:00:00 2001 From: Yussuf Shaikh Date: Mon, 4 Mar 2024 09:35:42 +0530 Subject: [PATCH 037/123] Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh --- .github/workflows/go.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index a683f780..959c3c05 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,11 +20,6 @@ jobs: with: go-version: '1.22' - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.20' - - name: Lint uses: golangci/golangci-lint-action@v5 with: From 34c82994164be31378af5a88a97300f384300908 Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Mon, 4 Mar 2024 08:14:06 -0600 Subject: [PATCH 038/123] Add branch to dependabot (#338) * Add branch to dependabot * Fix build --- .github/workflows/go.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 959c3c05..0b3a2d4c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -14,6 +14,10 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.20' - name: Set up Go uses: actions/setup-go@v5 From e29f5e735c7f965f5b81d02ecb03f27f51446d71 Mon Sep 17 00:00:00 2001 From: Yussuf Shaikh Date: Wed, 13 Mar 2024 21:15:47 +0530 Subject: [PATCH 039/123] Remove duplicate go setup step (#348) --- .github/workflows/go.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 0b3a2d4c..959c3c05 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -14,10 +14,6 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.20' - name: Set up Go uses: actions/setup-go@v5 From 3dd4a7731e35c67f9d3bcb3ece60d7b4b2423fda Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Fri, 1 Mar 2024 13:31:05 -0600 Subject: [PATCH 040/123] Update swagger client and models to service-broker v1.140.0 (#337) * Generated Swagger client from service-broker commit f482db37dd0b38392de1f3aecdc2219212147830 * Fix build --------- Co-authored-by: michael kad --- .github/workflows/go.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 959c3c05..25d5fa66 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -14,6 +14,11 @@ jobs: steps: - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.20' - name: Set up Go uses: actions/setup-go@v5 From 2721b1a9390c509d335e674a5839591ac18d1b66 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Wed, 13 Mar 2024 10:42:12 -0500 Subject: [PATCH 041/123] Update swagger client and models to service-broker v1.140.0 (#346) * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh * Update golangci-lint version and skip cache Signed-off-by: Yussuf Shaikh * Add branch to dependabot (#338) * Add branch to dependabot * Fix build * Generated Swagger client from service-broker commit 1db48bf5f665abf4e91c66d019aa231b913db3d9 --------- Signed-off-by: dependabot[bot] Signed-off-by: Yussuf Shaikh Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Yussuf Shaikh Co-authored-by: michaelkad <45772690+michaelkad@users.noreply.github.com> --- .github/workflows/go.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 25d5fa66..959c3c05 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -14,11 +14,6 @@ jobs: steps: - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.20' - name: Set up Go uses: actions/setup-go@v5 From 384490d6bb53265a6f67c6acba47250333272f07 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 02:29:29 +0000 Subject: [PATCH 042/123] Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] From 31a4db05d2fb2f6cafa30b66f31d18c900ef5e10 Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Mon, 4 Mar 2024 08:14:06 -0600 Subject: [PATCH 043/123] Add branch to dependabot (#338) * Add branch to dependabot * Fix build From 8df9adf74edd6ad457eb0d29be60e3126a136d65 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 02:29:29 +0000 Subject: [PATCH 044/123] Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] From 5408ea03caed5c025799053ee4c2a64113f19350 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Tue, 26 Mar 2024 08:30:07 -0500 Subject: [PATCH 045/123] Generated Swagger client from service-broker commit 70b0722398f5a64ea1e7bf1fbd07c6b3e7f8c9fc (#360) --- power/models/hostgroup_summary.go | 56 ------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 power/models/hostgroup_summary.go diff --git a/power/models/hostgroup_summary.go b/power/models/hostgroup_summary.go deleted file mode 100644 index 6112fd1d..00000000 --- a/power/models/hostgroup_summary.go +++ /dev/null @@ -1,56 +0,0 @@ -// 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" -) - -// HostgroupSummary hostgroup summary -// -// swagger:model HostgroupSummary -type HostgroupSummary struct { - - // Whether the hostgroup is a primary or secondary hostgroup - Access string `json:"access,omitempty"` - - // Link to the hostgroup resource - Href string `json:"href,omitempty"` - - // Name of the hostgroup - Name string `json:"name,omitempty"` -} - -// Validate validates this hostgroup summary -func (m *HostgroupSummary) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this hostgroup summary based on context it is used -func (m *HostgroupSummary) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *HostgroupSummary) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HostgroupSummary) UnmarshalBinary(b []byte) error { - var res HostgroupSummary - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} From 0bd5de1bdcdcf722092e94d9c1d9d8f4d3cc8df7 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Thu, 28 Mar 2024 09:03:36 -0500 Subject: [PATCH 046/123] Generated Swagger client from service-broker commit 384961399c43e0ea945615662e92396491168189 (#362) From 085edec6fd297ec467c19b864130983dc6b50ec0 Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Thu, 28 Mar 2024 10:05:13 -0500 Subject: [PATCH 047/123] Update Hostgroup client and add stratos validation (#361) * Update Hostgroup client and add stratos validation * Update name to hostGroup pattern * Rename file --- clients/instance/ibm-pi-hostgroups.go | 163 -------------------------- examples/hostgroups/main.go | 2 +- 2 files changed, 1 insertion(+), 164 deletions(-) delete mode 100644 clients/instance/ibm-pi-hostgroups.go diff --git a/clients/instance/ibm-pi-hostgroups.go b/clients/instance/ibm-pi-hostgroups.go deleted file mode 100644 index 4ded770e..00000000 --- a/clients/instance/ibm-pi-hostgroups.go +++ /dev/null @@ -1,163 +0,0 @@ -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/hostgroups" - "github.com/IBM-Cloud/power-go-client/power/models" -) - -// IBMPIHostgroupsClient -type IBMPIHostgroupsClient struct { - IBMPIClient -} - -// NewIBMPIHostgroupsClient -func NewIBMPHostgroupsClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPIHostgroupsClient { - return &IBMPIHostgroupsClient{ - *NewIBMPIClient(ctx, sess, cloudInstanceID), - } -} - -// Get All available hosts -func (f *IBMPIHostgroupsClient) GetAvailableHosts() (models.AvailableHostList, error) { - params := hostgroups.NewV1AvailableHostsParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut) - resp, err := f.session.Power.Hostgroups.V1AvailableHosts(params, f.session.AuthInfo(f.cloudInstanceID)) - if err != nil { - return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get available hosts for %s: %w", f.cloudInstanceID, err)) - } - - if resp == nil || resp.Payload == nil { - return nil, fmt.Errorf("failed to Get Available hosts") - } - return resp.Payload, nil -} - -// Get all Hostgroups -func (f *IBMPIHostgroupsClient) GetHostgroups() (models.HostgroupList, error) { - params := hostgroups.NewV1HostgroupsGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut) - resp, err := f.session.Power.Hostgroups.V1HostgroupsGet(params, f.session.AuthInfo(f.cloudInstanceID)) - if err != nil { - return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get Hostgroups for %s: %w", f.cloudInstanceID, err)) - } - - if resp == nil || resp.Payload == nil { - return nil, fmt.Errorf("failed to Get Hostgroups") - } - return resp.Payload, nil -} - -// Create a Hostgroup -func (f *IBMPIHostgroupsClient) CreateHostgroup(body *models.HostgroupCreate) (*models.Hostgroup, error) { - params := hostgroups.NewV1HostgroupsPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithBody(body) - resp, err := f.session.Power.Hostgroups.V1HostgroupsPost(params, f.session.AuthInfo(f.cloudInstanceID)) - if err != nil { - return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Create Hostgroup for %s: %w", f.cloudInstanceID, err)) - } - - if resp == nil || resp.Payload == nil { - return nil, fmt.Errorf("failed to Get Hostgroups") - } - return resp.Payload, nil -} - -// Update a Hostgroup -func (f *IBMPIHostgroupsClient) UpdateHostgroup(body *models.HostgroupShareOp, id string) (*models.Hostgroup, error) { - params := hostgroups.NewV1HostgroupsIDPutParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithBody(body).WithHostgroupID(id) - resp, err := f.session.Power.Hostgroups.V1HostgroupsIDPut(params, f.session.AuthInfo(f.cloudInstanceID)) - if err != nil { - return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Update Hostgroup for %s: %w", f.cloudInstanceID, err)) - } - - if resp == nil || resp.Payload == nil { - return nil, fmt.Errorf("failed to Update Hostgroups") - } - return resp.Payload, nil -} - -// Get a Hostgroup -func (f *IBMPIHostgroupsClient) GetHostgroup(id string) (*models.Hostgroup, error) { - params := hostgroups.NewV1HostgroupsIDGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithHostgroupID(id) - resp, err := f.session.Power.Hostgroups.V1HostgroupsIDGet(params, f.session.AuthInfo(f.cloudInstanceID)) - if err != nil { - return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Get Hostgroup %s for %s: %w", id, f.cloudInstanceID, err)) - } - - if resp == nil || resp.Payload == nil { - return nil, fmt.Errorf("failed to Get Hostgroup %s", id) - } - return resp.Payload, nil -} - -// Get All Hosts -func (f *IBMPIHostgroupsClient) GetHosts() (models.HostList, error) { - params := hostgroups.NewV1HostsGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut) - 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)) - } - - if resp == nil || resp.Payload == nil { - return nil, fmt.Errorf("failed to Get Hosts") - } - return resp.Payload, nil -} - -// Create a Host -func (f *IBMPIHostgroupsClient) CreateHost(body *models.HostCreate) (*models.Host, error) { - params := hostgroups.NewV1HostsPostParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithBody(body) - resp, err := f.session.Power.Hostgroups.V1HostsPost(params, f.session.AuthInfo(f.cloudInstanceID)) - if err != nil { - return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Create Hosts for %s: %w", f.cloudInstanceID, err)) - } - - if resp == nil || resp.Payload == nil { - return nil, fmt.Errorf("failed to Create Hosts") - } - return resp.Payload, nil -} - -// Get a Host -func (f *IBMPIHostgroupsClient) GetHost(id string) (*models.Host, error) { - params := hostgroups.NewV1HostsIDGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithHostID(id) - 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)) - } - - if resp == nil || resp.Payload == nil { - return nil, fmt.Errorf("failed to Get Host %s", id) - } - return resp.Payload, nil -} - -// Update a Host -func (f *IBMPIHostgroupsClient) UpdateHost(body *models.HostPut, id string) (*models.Host, error) { - params := hostgroups.NewV1HostsIDPutParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithHostID(id).WithBody(body) - resp, err := f.session.Power.Hostgroups.V1HostsIDPut(params, f.session.AuthInfo(f.cloudInstanceID)) - if err != nil { - return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Update Host %s for %s: %w", id, f.cloudInstanceID, err)) - } - - if resp == nil || resp.Payload == nil { - return nil, fmt.Errorf("failed to Update Host %s", id) - } - return resp.Payload, nil -} - -// Delete a Host -func (f *IBMPIHostgroupsClient) DeleteHost(id string) error { - params := hostgroups.NewV1HostsIDDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithHostID(id) - resp, err := f.session.Power.Hostgroups.V1HostsIDDelete(params, f.session.AuthInfo(f.cloudInstanceID)) - if err != nil { - return ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to Delete Host %s for %s: %w", id, f.cloudInstanceID, err)) - } - - if resp == nil || resp.Payload == nil { - return fmt.Errorf("failed to Delete Host %s", id) - } - return nil -} diff --git a/examples/hostgroups/main.go b/examples/hostgroups/main.go index d1ab8bfa..fbe1baeb 100644 --- a/examples/hostgroups/main.go +++ b/examples/hostgroups/main.go @@ -54,7 +54,7 @@ func main() { } log.Printf("***************[0]****************** %+v \n", getAllAvailableHost) - getHostgroups, err := powerClient.GetHostgroups() + getHostgroups, err := powerClient.GetHostGroups() if err != nil { log.Fatal(err) } From 2156a967082af315dec06c88800836f058d9edd5 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Thu, 4 Apr 2024 09:26:39 -0500 Subject: [PATCH 048/123] Generated Swagger client from service-broker commit e43ad9dd41dd11d0210c10b8ffa0104e1b74afd0 (#371) --- power/models/s_a_p_profile.go | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/power/models/s_a_p_profile.go b/power/models/s_a_p_profile.go index 86d688a2..fef54859 100644 --- a/power/models/s_a_p_profile.go +++ b/power/models/s_a_p_profile.go @@ -46,6 +46,11 @@ type SAPProfile struct { // Enum: [4,8] SmtMode int64 `json:"smtMode"` + // Required smt mode for that profile + // Required: true + // Enum: [4 8] + SmtMode *int64 `json:"smtMode"` + // List of supported systems SupportedSystems []string `json:"supportedSystems"` @@ -82,6 +87,10 @@ func (m *SAPProfile) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateSmtMode(formats); err != nil { + res = append(res, err) + } + if err := m.validateType(formats); err != nil { res = append(res, err) } @@ -161,6 +170,40 @@ func (m *SAPProfile) validateSmtMode(formats strfmt.Registry) error { return nil } +var sAPProfileTypeSmtModePropEnum []interface{} + +func init() { + var res []int64 + if err := json.Unmarshal([]byte(`[4,8]`), &res); err != nil { + panic(err) + } + for _, v := range res { + sAPProfileTypeSmtModePropEnum = append(sAPProfileTypeSmtModePropEnum, v) + } +} + +// prop value enum +func (m *SAPProfile) validateSmtModeEnum(path, location string, value int64) error { + if err := validate.EnumCase(path, location, value, sAPProfileTypeSmtModePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *SAPProfile) validateSmtMode(formats strfmt.Registry) error { + + if err := validate.Required("smtMode", "body", m.SmtMode); err != nil { + return err + } + + // value enum + if err := m.validateSmtModeEnum("smtMode", "body", *m.SmtMode); err != nil { + return err + } + + return nil +} + var sAPProfileTypeTypePropEnum []interface{} func init() { From 2f0fbb4163557c7eb422c09f98ec16c7d6451a94 Mon Sep 17 00:00:00 2001 From: ismirlia <90468712+ismirlia@users.noreply.github.com> Date: Mon, 15 Apr 2024 15:09:13 -0500 Subject: [PATCH 049/123] Fix error in host-group example (#376) There appeared to be a typo in the client definition preventing the example from compiling. --- examples/hostgroups/main.go | 62 ------------------------------------- 1 file changed, 62 deletions(-) delete mode 100644 examples/hostgroups/main.go diff --git a/examples/hostgroups/main.go b/examples/hostgroups/main.go deleted file mode 100644 index fbe1baeb..00000000 --- a/examples/hostgroups/main.go +++ /dev/null @@ -1,62 +0,0 @@ -package main - -import ( - "context" - "log" - - v "github.com/IBM-Cloud/power-go-client/clients/instance" - ps "github.com/IBM-Cloud/power-go-client/ibmpisession" - "github.com/IBM/go-sdk-core/v5/core" -) - -func main() { - //session Inputs - // < IAM TOKEN > - // token := "" - apiKey := "" - region := " < REGION > " - zone := " < ZONE > " - accountID := " < ACCOUNT ID > " - url := region + ".power-iaas.test.cloud.ibm.com" - - // dr location inputs - piID := " < POWER INSTANCE ID > " - - // authenticator := &core.BearerTokenAuthenticator{ - // BearerToken: token, - // } - authenticator := &core.IamAuthenticator{ - ApiKey: apiKey, - // Uncomment for test environment - URL: "https://iam.test.cloud.ibm.com", - } - - // Create the session - options := &ps.IBMPIOptions{ - Authenticator: authenticator, - UserAccount: accountID, - Zone: zone, - URL: url, - Debug: true, - } - session, err := ps.NewIBMPISession(options) - if err != nil { - log.Fatal(err) - } - powerClient := v.NewIBMPHostgroupsClient(context.Background(), session, piID) - if err != nil { - log.Fatal(err) - } - - getAllAvailableHost, err := powerClient.GetAvailableHosts() - if err != nil { - log.Fatal(err) - } - log.Printf("***************[0]****************** %+v \n", getAllAvailableHost) - - getHostgroups, err := powerClient.GetHostGroups() - if err != nil { - log.Fatal(err) - } - log.Printf("***************[1]****************** %+v \n", getHostgroups) -} From 26a48935181ccfabd6aa5d6c53b7507a3b37ecc4 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Mon, 17 Jun 2024 10:47:26 -0500 Subject: [PATCH 050/123] Generated Swagger client from service-broker commit 5fa65c3c11cd0c1479d3c3e135aa62c79cfd84bf (#405) From ba20c2d122d8923d97a5643d1748d5f70f418495 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Mon, 17 Jun 2024 10:48:33 -0500 Subject: [PATCH 051/123] Generated Swagger client from service-broker commit f856adaa7760209889781f329a122db016cc5587 (#408) From c67552eda3a26c0564648198098bff28db65a04f Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Mon, 17 Jun 2024 10:48:52 -0500 Subject: [PATCH 052/123] Generated Swagger client from service-broker commit b7a20105660b86a198fa90be0e47093ac3ff9a5d (#409) From 31f7fb597db2914baea0e3263066cc2d2c06b56e Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Tue, 16 Jul 2024 12:01:28 -0500 Subject: [PATCH 053/123] Generated Swagger client from service-broker commit 35aa4910370044d82d24dad103292b5963600875 (#427) --- power/models/capability_details.go | 157 ++++++++++++++++++++++++++ power/models/replication_services.go | 159 +++++++++++++++++++++++++++ 2 files changed, 316 insertions(+) create mode 100644 power/models/capability_details.go create mode 100644 power/models/replication_services.go diff --git a/power/models/capability_details.go b/power/models/capability_details.go new file mode 100644 index 00000000..1b2c0f42 --- /dev/null +++ b/power/models/capability_details.go @@ -0,0 +1,157 @@ +// 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" +) + +// CapabilityDetails capability details +// +// swagger:model CapabilityDetails +type CapabilityDetails struct { + + // Disaster Recovery Information + // Required: true + DisasterRecovery *DisasterRecovery `json:"disasterRecovery"` + + // Datacenter System Types Information + // Required: true + SupportedSystems *SupportedSystems `json:"supportedSystems"` +} + +// Validate validates this capability details +func (m *CapabilityDetails) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDisasterRecovery(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSupportedSystems(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CapabilityDetails) validateDisasterRecovery(formats strfmt.Registry) error { + + if err := validate.Required("disasterRecovery", "body", m.DisasterRecovery); err != nil { + return err + } + + if m.DisasterRecovery != nil { + if err := m.DisasterRecovery.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("disasterRecovery") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("disasterRecovery") + } + return err + } + } + + return nil +} + +func (m *CapabilityDetails) validateSupportedSystems(formats strfmt.Registry) error { + + if err := validate.Required("supportedSystems", "body", m.SupportedSystems); err != nil { + return err + } + + if m.SupportedSystems != nil { + if err := m.SupportedSystems.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("supportedSystems") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("supportedSystems") + } + return err + } + } + + return nil +} + +// ContextValidate validate this capability details based on the context it is used +func (m *CapabilityDetails) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDisasterRecovery(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSupportedSystems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CapabilityDetails) contextValidateDisasterRecovery(ctx context.Context, formats strfmt.Registry) error { + + if m.DisasterRecovery != nil { + + if err := m.DisasterRecovery.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("disasterRecovery") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("disasterRecovery") + } + return err + } + } + + return nil +} + +func (m *CapabilityDetails) contextValidateSupportedSystems(ctx context.Context, formats strfmt.Registry) error { + + if m.SupportedSystems != nil { + + if err := m.SupportedSystems.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("supportedSystems") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("supportedSystems") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CapabilityDetails) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CapabilityDetails) UnmarshalBinary(b []byte) error { + var res CapabilityDetails + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/replication_services.go b/power/models/replication_services.go new file mode 100644 index 00000000..637125d0 --- /dev/null +++ b/power/models/replication_services.go @@ -0,0 +1,159 @@ +// 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" +) + +// ReplicationServices replication services +// +// swagger:model ReplicationServices +type ReplicationServices struct { + + // Asynchronous Replication Target Information + // Required: true + AsynchronousReplication *ReplicationService `json:"asynchronousReplication"` + + // Synchronous Replication Target Information + SynchronousReplication *ReplicationService `json:"synchronousReplication,omitempty"` +} + +// Validate validates this replication services +func (m *ReplicationServices) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAsynchronousReplication(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSynchronousReplication(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ReplicationServices) validateAsynchronousReplication(formats strfmt.Registry) error { + + if err := validate.Required("asynchronousReplication", "body", m.AsynchronousReplication); err != nil { + return err + } + + if m.AsynchronousReplication != nil { + if err := m.AsynchronousReplication.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("asynchronousReplication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("asynchronousReplication") + } + return err + } + } + + return nil +} + +func (m *ReplicationServices) validateSynchronousReplication(formats strfmt.Registry) error { + if swag.IsZero(m.SynchronousReplication) { // not required + return nil + } + + if m.SynchronousReplication != nil { + if err := m.SynchronousReplication.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("synchronousReplication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("synchronousReplication") + } + return err + } + } + + return nil +} + +// ContextValidate validate this replication services based on the context it is used +func (m *ReplicationServices) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAsynchronousReplication(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSynchronousReplication(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ReplicationServices) contextValidateAsynchronousReplication(ctx context.Context, formats strfmt.Registry) error { + + if m.AsynchronousReplication != nil { + + if err := m.AsynchronousReplication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("asynchronousReplication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("asynchronousReplication") + } + return err + } + } + + return nil +} + +func (m *ReplicationServices) contextValidateSynchronousReplication(ctx context.Context, formats strfmt.Registry) error { + + if m.SynchronousReplication != nil { + + if swag.IsZero(m.SynchronousReplication) { // not required + return nil + } + + if err := m.SynchronousReplication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("synchronousReplication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("synchronousReplication") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ReplicationServices) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ReplicationServices) UnmarshalBinary(b []byte) error { + var res ReplicationServices + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} From c7d8dbfc6359d66268358645eef286f98fd23b22 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Thu, 25 Jul 2024 09:23:11 -0500 Subject: [PATCH 054/123] Generated Swagger client from service-broker commit 01eebb83bef64e16e87162c9c7654c8a166e5086 (#431) --- .../network_address_groups_client.go | 353 +++++++++ ...1_network_address_groups_get_parameters.go | 128 ++++ ...v1_network_address_groups_get_responses.go | 486 ++++++++++++ ...ork_address_groups_id_delete_parameters.go | 151 ++++ ...work_address_groups_id_delete_responses.go | 560 ++++++++++++++ ...etwork_address_groups_id_get_parameters.go | 151 ++++ ...network_address_groups_id_get_responses.go | 486 ++++++++++++ ...etwork_address_groups_id_put_parameters.go | 175 +++++ ...network_address_groups_id_put_responses.go | 486 ++++++++++++ ...ddress_groups_members_delete_parameters.go | 173 +++++ ...address_groups_members_delete_responses.go | 562 ++++++++++++++ ..._address_groups_members_post_parameters.go | 175 +++++ ...k_address_groups_members_post_responses.go | 638 ++++++++++++++++ ..._network_address_groups_post_parameters.go | 153 ++++ ...1_network_address_groups_post_responses.go | 714 ++++++++++++++++++ .../network_security_groups_client.go | 477 ++++++++++++ ..._security_groups_action_post_parameters.go | 153 ++++ ...k_security_groups_action_post_responses.go | 634 ++++++++++++++++ ...rk_security_groups_id_delete_parameters.go | 151 ++++ ...ork_security_groups_id_delete_responses.go | 560 ++++++++++++++ ...twork_security_groups_id_get_parameters.go | 151 ++++ ...etwork_security_groups_id_get_responses.go | 486 ++++++++++++ ...twork_security_groups_id_put_parameters.go | 175 +++++ ...etwork_security_groups_id_put_responses.go | 486 ++++++++++++ ...network_security_groups_list_parameters.go | 128 ++++ ..._network_security_groups_list_responses.go | 486 ++++++++++++ ...curity_groups_members_delete_parameters.go | 173 +++++ ...ecurity_groups_members_delete_responses.go | 562 ++++++++++++++ ...security_groups_members_post_parameters.go | 175 +++++ ..._security_groups_members_post_responses.go | 638 ++++++++++++++++ ...network_security_groups_post_parameters.go | 153 ++++ ..._network_security_groups_post_responses.go | 714 ++++++++++++++++++ ...security_groups_rules_delete_parameters.go | 173 +++++ ..._security_groups_rules_delete_responses.go | 562 ++++++++++++++ ...k_security_groups_rules_post_parameters.go | 175 +++++ ...rk_security_groups_rules_post_responses.go | 638 ++++++++++++++++ power/client/power_iaas_api_client.go | 10 + power/models/network_address_group.go | 176 +++++ .../network_address_group_add_member.go | 71 ++ power/models/network_address_group_create.go | 74 ++ power/models/network_address_group_member.go | 88 +++ power/models/network_address_group_update.go | 50 ++ power/models/network_address_groups.go | 121 +++ power/models/network_security_group.go | 238 ++++++ .../network_security_group_add_member.go | 124 +++ .../models/network_security_group_add_rule.go | 381 ++++++++++ power/models/network_security_group_create.go | 74 ++ power/models/network_security_group_member.go | 144 ++++ power/models/network_security_group_rule.go | 398 ++++++++++ .../network_security_group_rule_port.go | 53 ++ .../network_security_group_rule_protocol.go | 182 +++++ ...k_security_group_rule_protocol_tcp_flag.go | 126 ++++ .../network_security_group_rule_remote.go | 111 +++ power/models/network_security_group_update.go | 50 ++ power/models/network_security_groups.go | 121 +++ .../models/network_security_groups_action.go | 107 +++ power/models/workspace_details.go | 51 ++ ...rkspace_network_security_groups_details.go | 116 +++ 58 files changed, 16107 insertions(+) create mode 100644 power/client/network_address_groups/network_address_groups_client.go create mode 100644 power/client/network_address_groups/v1_network_address_groups_get_parameters.go create mode 100644 power/client/network_address_groups/v1_network_address_groups_get_responses.go create mode 100644 power/client/network_address_groups/v1_network_address_groups_id_delete_parameters.go create mode 100644 power/client/network_address_groups/v1_network_address_groups_id_delete_responses.go create mode 100644 power/client/network_address_groups/v1_network_address_groups_id_get_parameters.go create mode 100644 power/client/network_address_groups/v1_network_address_groups_id_get_responses.go create mode 100644 power/client/network_address_groups/v1_network_address_groups_id_put_parameters.go create mode 100644 power/client/network_address_groups/v1_network_address_groups_id_put_responses.go create mode 100644 power/client/network_address_groups/v1_network_address_groups_members_delete_parameters.go create mode 100644 power/client/network_address_groups/v1_network_address_groups_members_delete_responses.go create mode 100644 power/client/network_address_groups/v1_network_address_groups_members_post_parameters.go create mode 100644 power/client/network_address_groups/v1_network_address_groups_members_post_responses.go create mode 100644 power/client/network_address_groups/v1_network_address_groups_post_parameters.go create mode 100644 power/client/network_address_groups/v1_network_address_groups_post_responses.go create mode 100644 power/client/network_security_groups/network_security_groups_client.go create mode 100644 power/client/network_security_groups/v1_network_security_groups_action_post_parameters.go create mode 100644 power/client/network_security_groups/v1_network_security_groups_action_post_responses.go create mode 100644 power/client/network_security_groups/v1_network_security_groups_id_delete_parameters.go create mode 100644 power/client/network_security_groups/v1_network_security_groups_id_delete_responses.go create mode 100644 power/client/network_security_groups/v1_network_security_groups_id_get_parameters.go create mode 100644 power/client/network_security_groups/v1_network_security_groups_id_get_responses.go create mode 100644 power/client/network_security_groups/v1_network_security_groups_id_put_parameters.go create mode 100644 power/client/network_security_groups/v1_network_security_groups_id_put_responses.go create mode 100644 power/client/network_security_groups/v1_network_security_groups_list_parameters.go create mode 100644 power/client/network_security_groups/v1_network_security_groups_list_responses.go create mode 100644 power/client/network_security_groups/v1_network_security_groups_members_delete_parameters.go create mode 100644 power/client/network_security_groups/v1_network_security_groups_members_delete_responses.go create mode 100644 power/client/network_security_groups/v1_network_security_groups_members_post_parameters.go create mode 100644 power/client/network_security_groups/v1_network_security_groups_members_post_responses.go create mode 100644 power/client/network_security_groups/v1_network_security_groups_post_parameters.go create mode 100644 power/client/network_security_groups/v1_network_security_groups_post_responses.go create mode 100644 power/client/network_security_groups/v1_network_security_groups_rules_delete_parameters.go create mode 100644 power/client/network_security_groups/v1_network_security_groups_rules_delete_responses.go create mode 100644 power/client/network_security_groups/v1_network_security_groups_rules_post_parameters.go create mode 100644 power/client/network_security_groups/v1_network_security_groups_rules_post_responses.go create mode 100644 power/models/network_address_group.go create mode 100644 power/models/network_address_group_add_member.go create mode 100644 power/models/network_address_group_create.go create mode 100644 power/models/network_address_group_member.go create mode 100644 power/models/network_address_group_update.go create mode 100644 power/models/network_address_groups.go create mode 100644 power/models/network_security_group.go create mode 100644 power/models/network_security_group_add_member.go create mode 100644 power/models/network_security_group_add_rule.go create mode 100644 power/models/network_security_group_create.go create mode 100644 power/models/network_security_group_member.go create mode 100644 power/models/network_security_group_rule.go create mode 100644 power/models/network_security_group_rule_port.go create mode 100644 power/models/network_security_group_rule_protocol.go create mode 100644 power/models/network_security_group_rule_protocol_tcp_flag.go create mode 100644 power/models/network_security_group_rule_remote.go create mode 100644 power/models/network_security_group_update.go create mode 100644 power/models/network_security_groups.go create mode 100644 power/models/network_security_groups_action.go create mode 100644 power/models/workspace_network_security_groups_details.go diff --git a/power/client/network_address_groups/network_address_groups_client.go b/power/client/network_address_groups/network_address_groups_client.go new file mode 100644 index 00000000..e2e3af98 --- /dev/null +++ b/power/client/network_address_groups/network_address_groups_client.go @@ -0,0 +1,353 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// 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 address groups API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new network address groups 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 address groups 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 address groups 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 { + V1NetworkAddressGroupsGet(params *V1NetworkAddressGroupsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsGetOK, error) + + V1NetworkAddressGroupsIDDelete(params *V1NetworkAddressGroupsIDDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsIDDeleteOK, error) + + V1NetworkAddressGroupsIDGet(params *V1NetworkAddressGroupsIDGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsIDGetOK, error) + + V1NetworkAddressGroupsIDPut(params *V1NetworkAddressGroupsIDPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsIDPutOK, error) + + V1NetworkAddressGroupsMembersDelete(params *V1NetworkAddressGroupsMembersDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsMembersDeleteOK, error) + + V1NetworkAddressGroupsMembersPost(params *V1NetworkAddressGroupsMembersPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsMembersPostOK, error) + + V1NetworkAddressGroupsPost(params *V1NetworkAddressGroupsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsPostOK, *V1NetworkAddressGroupsPostCreated, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +V1NetworkAddressGroupsGet gets the list of network address groups for a workspace +*/ +func (a *Client) V1NetworkAddressGroupsGet(params *V1NetworkAddressGroupsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkAddressGroupsGetParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkAddressGroups.get", + Method: "GET", + PathPattern: "/v1/network-address-groups", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkAddressGroupsGetReader{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.(*V1NetworkAddressGroupsGetOK) + 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.networkAddressGroups.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkAddressGroupsIDDelete deletes a network address group from a workspace +*/ +func (a *Client) V1NetworkAddressGroupsIDDelete(params *V1NetworkAddressGroupsIDDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsIDDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkAddressGroupsIDDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkAddressGroups.id.delete", + Method: "DELETE", + PathPattern: "/v1/network-address-groups/{network_address_group_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkAddressGroupsIDDeleteReader{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.(*V1NetworkAddressGroupsIDDeleteOK) + 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.networkAddressGroups.id.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkAddressGroupsIDGet gets the detail of a network address group +*/ +func (a *Client) V1NetworkAddressGroupsIDGet(params *V1NetworkAddressGroupsIDGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsIDGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkAddressGroupsIDGetParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkAddressGroups.id.get", + Method: "GET", + PathPattern: "/v1/network-address-groups/{network_address_group_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkAddressGroupsIDGetReader{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.(*V1NetworkAddressGroupsIDGetOK) + 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.networkAddressGroups.id.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkAddressGroupsIDPut updates a network address group +*/ +func (a *Client) V1NetworkAddressGroupsIDPut(params *V1NetworkAddressGroupsIDPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsIDPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkAddressGroupsIDPutParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkAddressGroups.id.put", + Method: "PUT", + PathPattern: "/v1/network-address-groups/{network_address_group_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkAddressGroupsIDPutReader{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.(*V1NetworkAddressGroupsIDPutOK) + 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.networkAddressGroups.id.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkAddressGroupsMembersDelete deletes the member from a network address group +*/ +func (a *Client) V1NetworkAddressGroupsMembersDelete(params *V1NetworkAddressGroupsMembersDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsMembersDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkAddressGroupsMembersDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkAddressGroups.members.delete", + Method: "DELETE", + PathPattern: "/v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkAddressGroupsMembersDeleteReader{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.(*V1NetworkAddressGroupsMembersDeleteOK) + 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.networkAddressGroups.members.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkAddressGroupsMembersPost adds a member to a network address group +*/ +func (a *Client) V1NetworkAddressGroupsMembersPost(params *V1NetworkAddressGroupsMembersPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsMembersPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkAddressGroupsMembersPostParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkAddressGroups.members.post", + Method: "POST", + PathPattern: "/v1/network-address-groups/{network_address_group_id}/members", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkAddressGroupsMembersPostReader{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.(*V1NetworkAddressGroupsMembersPostOK) + 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.networkAddressGroups.members.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkAddressGroupsPost creates a new network address group +*/ +func (a *Client) V1NetworkAddressGroupsPost(params *V1NetworkAddressGroupsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsPostOK, *V1NetworkAddressGroupsPostCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkAddressGroupsPostParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkAddressGroups.post", + Method: "POST", + PathPattern: "/v1/network-address-groups", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkAddressGroupsPostReader{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, nil, err + } + switch value := result.(type) { + case *V1NetworkAddressGroupsPostOK: + return value, nil, nil + case *V1NetworkAddressGroupsPostCreated: + return nil, value, nil + } + // 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 network_address_groups: 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_address_groups/v1_network_address_groups_get_parameters.go b/power/client/network_address_groups/v1_network_address_groups_get_parameters.go new file mode 100644 index 00000000..6e230a35 --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// 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" +) + +// NewV1NetworkAddressGroupsGetParams creates a new V1NetworkAddressGroupsGetParams 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 NewV1NetworkAddressGroupsGetParams() *V1NetworkAddressGroupsGetParams { + return &V1NetworkAddressGroupsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkAddressGroupsGetParamsWithTimeout creates a new V1NetworkAddressGroupsGetParams object +// with the ability to set a timeout on a request. +func NewV1NetworkAddressGroupsGetParamsWithTimeout(timeout time.Duration) *V1NetworkAddressGroupsGetParams { + return &V1NetworkAddressGroupsGetParams{ + timeout: timeout, + } +} + +// NewV1NetworkAddressGroupsGetParamsWithContext creates a new V1NetworkAddressGroupsGetParams object +// with the ability to set a context for a request. +func NewV1NetworkAddressGroupsGetParamsWithContext(ctx context.Context) *V1NetworkAddressGroupsGetParams { + return &V1NetworkAddressGroupsGetParams{ + Context: ctx, + } +} + +// NewV1NetworkAddressGroupsGetParamsWithHTTPClient creates a new V1NetworkAddressGroupsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkAddressGroupsGetParamsWithHTTPClient(client *http.Client) *V1NetworkAddressGroupsGetParams { + return &V1NetworkAddressGroupsGetParams{ + HTTPClient: client, + } +} + +/* +V1NetworkAddressGroupsGetParams contains all the parameters to send to the API endpoint + + for the v1 network address groups get operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkAddressGroupsGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network address groups get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsGetParams) WithDefaults() *V1NetworkAddressGroupsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network address groups get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network address groups get params +func (o *V1NetworkAddressGroupsGetParams) WithTimeout(timeout time.Duration) *V1NetworkAddressGroupsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network address groups get params +func (o *V1NetworkAddressGroupsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network address groups get params +func (o *V1NetworkAddressGroupsGetParams) WithContext(ctx context.Context) *V1NetworkAddressGroupsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network address groups get params +func (o *V1NetworkAddressGroupsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network address groups get params +func (o *V1NetworkAddressGroupsGetParams) WithHTTPClient(client *http.Client) *V1NetworkAddressGroupsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network address groups get params +func (o *V1NetworkAddressGroupsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkAddressGroupsGetParams) 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_address_groups/v1_network_address_groups_get_responses.go b/power/client/network_address_groups/v1_network_address_groups_get_responses.go new file mode 100644 index 00000000..5716e64c --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_get_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// 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" +) + +// V1NetworkAddressGroupsGetReader is a Reader for the V1NetworkAddressGroupsGet structure. +type V1NetworkAddressGroupsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkAddressGroupsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkAddressGroupsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkAddressGroupsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkAddressGroupsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkAddressGroupsGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkAddressGroupsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkAddressGroupsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/network-address-groups] v1.networkAddressGroups.get", response, response.Code()) + } +} + +// NewV1NetworkAddressGroupsGetOK creates a V1NetworkAddressGroupsGetOK with default headers values +func NewV1NetworkAddressGroupsGetOK() *V1NetworkAddressGroupsGetOK { + return &V1NetworkAddressGroupsGetOK{} +} + +/* +V1NetworkAddressGroupsGetOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkAddressGroupsGetOK struct { + Payload *models.NetworkAddressGroups +} + +// IsSuccess returns true when this v1 network address groups get o k response has a 2xx status code +func (o *V1NetworkAddressGroupsGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network address groups get o k response has a 3xx status code +func (o *V1NetworkAddressGroupsGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups get o k response has a 4xx status code +func (o *V1NetworkAddressGroupsGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups get o k response has a 5xx status code +func (o *V1NetworkAddressGroupsGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups get o k response a status code equal to that given +func (o *V1NetworkAddressGroupsGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network address groups get o k response +func (o *V1NetworkAddressGroupsGetOK) Code() int { + return 200 +} + +func (o *V1NetworkAddressGroupsGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsGetOK) GetPayload() *models.NetworkAddressGroups { + return o.Payload +} + +func (o *V1NetworkAddressGroupsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkAddressGroups) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsGetBadRequest creates a V1NetworkAddressGroupsGetBadRequest with default headers values +func NewV1NetworkAddressGroupsGetBadRequest() *V1NetworkAddressGroupsGetBadRequest { + return &V1NetworkAddressGroupsGetBadRequest{} +} + +/* +V1NetworkAddressGroupsGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkAddressGroupsGetBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups get bad request response has a 2xx status code +func (o *V1NetworkAddressGroupsGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups get bad request response has a 3xx status code +func (o *V1NetworkAddressGroupsGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups get bad request response has a 4xx status code +func (o *V1NetworkAddressGroupsGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups get bad request response has a 5xx status code +func (o *V1NetworkAddressGroupsGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups get bad request response a status code equal to that given +func (o *V1NetworkAddressGroupsGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network address groups get bad request response +func (o *V1NetworkAddressGroupsGetBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkAddressGroupsGetBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsGetBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsGetBadRequest) 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 +} + +// NewV1NetworkAddressGroupsGetUnauthorized creates a V1NetworkAddressGroupsGetUnauthorized with default headers values +func NewV1NetworkAddressGroupsGetUnauthorized() *V1NetworkAddressGroupsGetUnauthorized { + return &V1NetworkAddressGroupsGetUnauthorized{} +} + +/* +V1NetworkAddressGroupsGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkAddressGroupsGetUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups get unauthorized response has a 2xx status code +func (o *V1NetworkAddressGroupsGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups get unauthorized response has a 3xx status code +func (o *V1NetworkAddressGroupsGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups get unauthorized response has a 4xx status code +func (o *V1NetworkAddressGroupsGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups get unauthorized response has a 5xx status code +func (o *V1NetworkAddressGroupsGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups get unauthorized response a status code equal to that given +func (o *V1NetworkAddressGroupsGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network address groups get unauthorized response +func (o *V1NetworkAddressGroupsGetUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkAddressGroupsGetUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsGetUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsGetUnauthorized) 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 +} + +// NewV1NetworkAddressGroupsGetForbidden creates a V1NetworkAddressGroupsGetForbidden with default headers values +func NewV1NetworkAddressGroupsGetForbidden() *V1NetworkAddressGroupsGetForbidden { + return &V1NetworkAddressGroupsGetForbidden{} +} + +/* +V1NetworkAddressGroupsGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkAddressGroupsGetForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups get forbidden response has a 2xx status code +func (o *V1NetworkAddressGroupsGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups get forbidden response has a 3xx status code +func (o *V1NetworkAddressGroupsGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups get forbidden response has a 4xx status code +func (o *V1NetworkAddressGroupsGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups get forbidden response has a 5xx status code +func (o *V1NetworkAddressGroupsGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups get forbidden response a status code equal to that given +func (o *V1NetworkAddressGroupsGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network address groups get forbidden response +func (o *V1NetworkAddressGroupsGetForbidden) Code() int { + return 403 +} + +func (o *V1NetworkAddressGroupsGetForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsGetForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsGetForbidden) 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 +} + +// NewV1NetworkAddressGroupsGetNotFound creates a V1NetworkAddressGroupsGetNotFound with default headers values +func NewV1NetworkAddressGroupsGetNotFound() *V1NetworkAddressGroupsGetNotFound { + return &V1NetworkAddressGroupsGetNotFound{} +} + +/* +V1NetworkAddressGroupsGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkAddressGroupsGetNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups get not found response has a 2xx status code +func (o *V1NetworkAddressGroupsGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups get not found response has a 3xx status code +func (o *V1NetworkAddressGroupsGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups get not found response has a 4xx status code +func (o *V1NetworkAddressGroupsGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups get not found response has a 5xx status code +func (o *V1NetworkAddressGroupsGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups get not found response a status code equal to that given +func (o *V1NetworkAddressGroupsGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network address groups get not found response +func (o *V1NetworkAddressGroupsGetNotFound) Code() int { + return 404 +} + +func (o *V1NetworkAddressGroupsGetNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsGetNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsGetNotFound) 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 +} + +// NewV1NetworkAddressGroupsGetInternalServerError creates a V1NetworkAddressGroupsGetInternalServerError with default headers values +func NewV1NetworkAddressGroupsGetInternalServerError() *V1NetworkAddressGroupsGetInternalServerError { + return &V1NetworkAddressGroupsGetInternalServerError{} +} + +/* +V1NetworkAddressGroupsGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkAddressGroupsGetInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups get internal server error response has a 2xx status code +func (o *V1NetworkAddressGroupsGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups get internal server error response has a 3xx status code +func (o *V1NetworkAddressGroupsGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups get internal server error response has a 4xx status code +func (o *V1NetworkAddressGroupsGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups get internal server error response has a 5xx status code +func (o *V1NetworkAddressGroupsGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network address groups get internal server error response a status code equal to that given +func (o *V1NetworkAddressGroupsGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network address groups get internal server error response +func (o *V1NetworkAddressGroupsGetInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkAddressGroupsGetInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsGetInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsGetInternalServerError) 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/network_address_groups/v1_network_address_groups_id_delete_parameters.go b/power/client/network_address_groups/v1_network_address_groups_id_delete_parameters.go new file mode 100644 index 00000000..fb6028a1 --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_id_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// 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" +) + +// NewV1NetworkAddressGroupsIDDeleteParams creates a new V1NetworkAddressGroupsIDDeleteParams 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 NewV1NetworkAddressGroupsIDDeleteParams() *V1NetworkAddressGroupsIDDeleteParams { + return &V1NetworkAddressGroupsIDDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkAddressGroupsIDDeleteParamsWithTimeout creates a new V1NetworkAddressGroupsIDDeleteParams object +// with the ability to set a timeout on a request. +func NewV1NetworkAddressGroupsIDDeleteParamsWithTimeout(timeout time.Duration) *V1NetworkAddressGroupsIDDeleteParams { + return &V1NetworkAddressGroupsIDDeleteParams{ + timeout: timeout, + } +} + +// NewV1NetworkAddressGroupsIDDeleteParamsWithContext creates a new V1NetworkAddressGroupsIDDeleteParams object +// with the ability to set a context for a request. +func NewV1NetworkAddressGroupsIDDeleteParamsWithContext(ctx context.Context) *V1NetworkAddressGroupsIDDeleteParams { + return &V1NetworkAddressGroupsIDDeleteParams{ + Context: ctx, + } +} + +// NewV1NetworkAddressGroupsIDDeleteParamsWithHTTPClient creates a new V1NetworkAddressGroupsIDDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkAddressGroupsIDDeleteParamsWithHTTPClient(client *http.Client) *V1NetworkAddressGroupsIDDeleteParams { + return &V1NetworkAddressGroupsIDDeleteParams{ + HTTPClient: client, + } +} + +/* +V1NetworkAddressGroupsIDDeleteParams contains all the parameters to send to the API endpoint + + for the v1 network address groups id delete operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkAddressGroupsIDDeleteParams struct { + + /* NetworkAddressGroupID. + + Network Address Group ID + */ + NetworkAddressGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network address groups id delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsIDDeleteParams) WithDefaults() *V1NetworkAddressGroupsIDDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network address groups id delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsIDDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network address groups id delete params +func (o *V1NetworkAddressGroupsIDDeleteParams) WithTimeout(timeout time.Duration) *V1NetworkAddressGroupsIDDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network address groups id delete params +func (o *V1NetworkAddressGroupsIDDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network address groups id delete params +func (o *V1NetworkAddressGroupsIDDeleteParams) WithContext(ctx context.Context) *V1NetworkAddressGroupsIDDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network address groups id delete params +func (o *V1NetworkAddressGroupsIDDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network address groups id delete params +func (o *V1NetworkAddressGroupsIDDeleteParams) WithHTTPClient(client *http.Client) *V1NetworkAddressGroupsIDDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network address groups id delete params +func (o *V1NetworkAddressGroupsIDDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNetworkAddressGroupID adds the networkAddressGroupID to the v1 network address groups id delete params +func (o *V1NetworkAddressGroupsIDDeleteParams) WithNetworkAddressGroupID(networkAddressGroupID string) *V1NetworkAddressGroupsIDDeleteParams { + o.SetNetworkAddressGroupID(networkAddressGroupID) + return o +} + +// SetNetworkAddressGroupID adds the networkAddressGroupId to the v1 network address groups id delete params +func (o *V1NetworkAddressGroupsIDDeleteParams) SetNetworkAddressGroupID(networkAddressGroupID string) { + o.NetworkAddressGroupID = networkAddressGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkAddressGroupsIDDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param network_address_group_id + if err := r.SetPathParam("network_address_group_id", o.NetworkAddressGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_address_groups/v1_network_address_groups_id_delete_responses.go b/power/client/network_address_groups/v1_network_address_groups_id_delete_responses.go new file mode 100644 index 00000000..92768813 --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_id_delete_responses.go @@ -0,0 +1,560 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// 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" +) + +// V1NetworkAddressGroupsIDDeleteReader is a Reader for the V1NetworkAddressGroupsIDDelete structure. +type V1NetworkAddressGroupsIDDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkAddressGroupsIDDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkAddressGroupsIDDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkAddressGroupsIDDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkAddressGroupsIDDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkAddressGroupsIDDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkAddressGroupsIDDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkAddressGroupsIDDeleteConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkAddressGroupsIDDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /v1/network-address-groups/{network_address_group_id}] v1.networkAddressGroups.id.delete", response, response.Code()) + } +} + +// NewV1NetworkAddressGroupsIDDeleteOK creates a V1NetworkAddressGroupsIDDeleteOK with default headers values +func NewV1NetworkAddressGroupsIDDeleteOK() *V1NetworkAddressGroupsIDDeleteOK { + return &V1NetworkAddressGroupsIDDeleteOK{} +} + +/* +V1NetworkAddressGroupsIDDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkAddressGroupsIDDeleteOK struct { + Payload models.Object +} + +// IsSuccess returns true when this v1 network address groups Id delete o k response has a 2xx status code +func (o *V1NetworkAddressGroupsIDDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network address groups Id delete o k response has a 3xx status code +func (o *V1NetworkAddressGroupsIDDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id delete o k response has a 4xx status code +func (o *V1NetworkAddressGroupsIDDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups Id delete o k response has a 5xx status code +func (o *V1NetworkAddressGroupsIDDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id delete o k response a status code equal to that given +func (o *V1NetworkAddressGroupsIDDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network address groups Id delete o k response +func (o *V1NetworkAddressGroupsIDDeleteOK) Code() int { + return 200 +} + +func (o *V1NetworkAddressGroupsIDDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDDeleteOK) 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 +} + +// NewV1NetworkAddressGroupsIDDeleteBadRequest creates a V1NetworkAddressGroupsIDDeleteBadRequest with default headers values +func NewV1NetworkAddressGroupsIDDeleteBadRequest() *V1NetworkAddressGroupsIDDeleteBadRequest { + return &V1NetworkAddressGroupsIDDeleteBadRequest{} +} + +/* +V1NetworkAddressGroupsIDDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkAddressGroupsIDDeleteBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id delete bad request response has a 2xx status code +func (o *V1NetworkAddressGroupsIDDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id delete bad request response has a 3xx status code +func (o *V1NetworkAddressGroupsIDDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id delete bad request response has a 4xx status code +func (o *V1NetworkAddressGroupsIDDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id delete bad request response has a 5xx status code +func (o *V1NetworkAddressGroupsIDDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id delete bad request response a status code equal to that given +func (o *V1NetworkAddressGroupsIDDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network address groups Id delete bad request response +func (o *V1NetworkAddressGroupsIDDeleteBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkAddressGroupsIDDeleteBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDDeleteBadRequest) 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 +} + +// NewV1NetworkAddressGroupsIDDeleteUnauthorized creates a V1NetworkAddressGroupsIDDeleteUnauthorized with default headers values +func NewV1NetworkAddressGroupsIDDeleteUnauthorized() *V1NetworkAddressGroupsIDDeleteUnauthorized { + return &V1NetworkAddressGroupsIDDeleteUnauthorized{} +} + +/* +V1NetworkAddressGroupsIDDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkAddressGroupsIDDeleteUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id delete unauthorized response has a 2xx status code +func (o *V1NetworkAddressGroupsIDDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id delete unauthorized response has a 3xx status code +func (o *V1NetworkAddressGroupsIDDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id delete unauthorized response has a 4xx status code +func (o *V1NetworkAddressGroupsIDDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id delete unauthorized response has a 5xx status code +func (o *V1NetworkAddressGroupsIDDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id delete unauthorized response a status code equal to that given +func (o *V1NetworkAddressGroupsIDDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network address groups Id delete unauthorized response +func (o *V1NetworkAddressGroupsIDDeleteUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkAddressGroupsIDDeleteUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDDeleteUnauthorized) 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 +} + +// NewV1NetworkAddressGroupsIDDeleteForbidden creates a V1NetworkAddressGroupsIDDeleteForbidden with default headers values +func NewV1NetworkAddressGroupsIDDeleteForbidden() *V1NetworkAddressGroupsIDDeleteForbidden { + return &V1NetworkAddressGroupsIDDeleteForbidden{} +} + +/* +V1NetworkAddressGroupsIDDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkAddressGroupsIDDeleteForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id delete forbidden response has a 2xx status code +func (o *V1NetworkAddressGroupsIDDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id delete forbidden response has a 3xx status code +func (o *V1NetworkAddressGroupsIDDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id delete forbidden response has a 4xx status code +func (o *V1NetworkAddressGroupsIDDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id delete forbidden response has a 5xx status code +func (o *V1NetworkAddressGroupsIDDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id delete forbidden response a status code equal to that given +func (o *V1NetworkAddressGroupsIDDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network address groups Id delete forbidden response +func (o *V1NetworkAddressGroupsIDDeleteForbidden) Code() int { + return 403 +} + +func (o *V1NetworkAddressGroupsIDDeleteForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDDeleteForbidden) 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 +} + +// NewV1NetworkAddressGroupsIDDeleteNotFound creates a V1NetworkAddressGroupsIDDeleteNotFound with default headers values +func NewV1NetworkAddressGroupsIDDeleteNotFound() *V1NetworkAddressGroupsIDDeleteNotFound { + return &V1NetworkAddressGroupsIDDeleteNotFound{} +} + +/* +V1NetworkAddressGroupsIDDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkAddressGroupsIDDeleteNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id delete not found response has a 2xx status code +func (o *V1NetworkAddressGroupsIDDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id delete not found response has a 3xx status code +func (o *V1NetworkAddressGroupsIDDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id delete not found response has a 4xx status code +func (o *V1NetworkAddressGroupsIDDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id delete not found response has a 5xx status code +func (o *V1NetworkAddressGroupsIDDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id delete not found response a status code equal to that given +func (o *V1NetworkAddressGroupsIDDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network address groups Id delete not found response +func (o *V1NetworkAddressGroupsIDDeleteNotFound) Code() int { + return 404 +} + +func (o *V1NetworkAddressGroupsIDDeleteNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDDeleteNotFound) 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 +} + +// NewV1NetworkAddressGroupsIDDeleteConflict creates a V1NetworkAddressGroupsIDDeleteConflict with default headers values +func NewV1NetworkAddressGroupsIDDeleteConflict() *V1NetworkAddressGroupsIDDeleteConflict { + return &V1NetworkAddressGroupsIDDeleteConflict{} +} + +/* +V1NetworkAddressGroupsIDDeleteConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkAddressGroupsIDDeleteConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id delete conflict response has a 2xx status code +func (o *V1NetworkAddressGroupsIDDeleteConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id delete conflict response has a 3xx status code +func (o *V1NetworkAddressGroupsIDDeleteConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id delete conflict response has a 4xx status code +func (o *V1NetworkAddressGroupsIDDeleteConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id delete conflict response has a 5xx status code +func (o *V1NetworkAddressGroupsIDDeleteConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id delete conflict response a status code equal to that given +func (o *V1NetworkAddressGroupsIDDeleteConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network address groups Id delete conflict response +func (o *V1NetworkAddressGroupsIDDeleteConflict) Code() int { + return 409 +} + +func (o *V1NetworkAddressGroupsIDDeleteConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteConflict %s", 409, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteConflict %s", 409, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDDeleteConflict) 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 +} + +// NewV1NetworkAddressGroupsIDDeleteInternalServerError creates a V1NetworkAddressGroupsIDDeleteInternalServerError with default headers values +func NewV1NetworkAddressGroupsIDDeleteInternalServerError() *V1NetworkAddressGroupsIDDeleteInternalServerError { + return &V1NetworkAddressGroupsIDDeleteInternalServerError{} +} + +/* +V1NetworkAddressGroupsIDDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkAddressGroupsIDDeleteInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id delete internal server error response has a 2xx status code +func (o *V1NetworkAddressGroupsIDDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id delete internal server error response has a 3xx status code +func (o *V1NetworkAddressGroupsIDDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id delete internal server error response has a 4xx status code +func (o *V1NetworkAddressGroupsIDDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups Id delete internal server error response has a 5xx status code +func (o *V1NetworkAddressGroupsIDDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network address groups Id delete internal server error response a status code equal to that given +func (o *V1NetworkAddressGroupsIDDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network address groups Id delete internal server error response +func (o *V1NetworkAddressGroupsIDDeleteInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkAddressGroupsIDDeleteInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDDeleteInternalServerError) 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/network_address_groups/v1_network_address_groups_id_get_parameters.go b/power/client/network_address_groups/v1_network_address_groups_id_get_parameters.go new file mode 100644 index 00000000..0e9784c9 --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_id_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// 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" +) + +// NewV1NetworkAddressGroupsIDGetParams creates a new V1NetworkAddressGroupsIDGetParams 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 NewV1NetworkAddressGroupsIDGetParams() *V1NetworkAddressGroupsIDGetParams { + return &V1NetworkAddressGroupsIDGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkAddressGroupsIDGetParamsWithTimeout creates a new V1NetworkAddressGroupsIDGetParams object +// with the ability to set a timeout on a request. +func NewV1NetworkAddressGroupsIDGetParamsWithTimeout(timeout time.Duration) *V1NetworkAddressGroupsIDGetParams { + return &V1NetworkAddressGroupsIDGetParams{ + timeout: timeout, + } +} + +// NewV1NetworkAddressGroupsIDGetParamsWithContext creates a new V1NetworkAddressGroupsIDGetParams object +// with the ability to set a context for a request. +func NewV1NetworkAddressGroupsIDGetParamsWithContext(ctx context.Context) *V1NetworkAddressGroupsIDGetParams { + return &V1NetworkAddressGroupsIDGetParams{ + Context: ctx, + } +} + +// NewV1NetworkAddressGroupsIDGetParamsWithHTTPClient creates a new V1NetworkAddressGroupsIDGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkAddressGroupsIDGetParamsWithHTTPClient(client *http.Client) *V1NetworkAddressGroupsIDGetParams { + return &V1NetworkAddressGroupsIDGetParams{ + HTTPClient: client, + } +} + +/* +V1NetworkAddressGroupsIDGetParams contains all the parameters to send to the API endpoint + + for the v1 network address groups id get operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkAddressGroupsIDGetParams struct { + + /* NetworkAddressGroupID. + + Network Address Group ID + */ + NetworkAddressGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network address groups id get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsIDGetParams) WithDefaults() *V1NetworkAddressGroupsIDGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network address groups id get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsIDGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network address groups id get params +func (o *V1NetworkAddressGroupsIDGetParams) WithTimeout(timeout time.Duration) *V1NetworkAddressGroupsIDGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network address groups id get params +func (o *V1NetworkAddressGroupsIDGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network address groups id get params +func (o *V1NetworkAddressGroupsIDGetParams) WithContext(ctx context.Context) *V1NetworkAddressGroupsIDGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network address groups id get params +func (o *V1NetworkAddressGroupsIDGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network address groups id get params +func (o *V1NetworkAddressGroupsIDGetParams) WithHTTPClient(client *http.Client) *V1NetworkAddressGroupsIDGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network address groups id get params +func (o *V1NetworkAddressGroupsIDGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNetworkAddressGroupID adds the networkAddressGroupID to the v1 network address groups id get params +func (o *V1NetworkAddressGroupsIDGetParams) WithNetworkAddressGroupID(networkAddressGroupID string) *V1NetworkAddressGroupsIDGetParams { + o.SetNetworkAddressGroupID(networkAddressGroupID) + return o +} + +// SetNetworkAddressGroupID adds the networkAddressGroupId to the v1 network address groups id get params +func (o *V1NetworkAddressGroupsIDGetParams) SetNetworkAddressGroupID(networkAddressGroupID string) { + o.NetworkAddressGroupID = networkAddressGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkAddressGroupsIDGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param network_address_group_id + if err := r.SetPathParam("network_address_group_id", o.NetworkAddressGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_address_groups/v1_network_address_groups_id_get_responses.go b/power/client/network_address_groups/v1_network_address_groups_id_get_responses.go new file mode 100644 index 00000000..fb0df93b --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_id_get_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// 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" +) + +// V1NetworkAddressGroupsIDGetReader is a Reader for the V1NetworkAddressGroupsIDGet structure. +type V1NetworkAddressGroupsIDGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkAddressGroupsIDGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkAddressGroupsIDGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkAddressGroupsIDGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkAddressGroupsIDGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkAddressGroupsIDGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkAddressGroupsIDGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkAddressGroupsIDGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/network-address-groups/{network_address_group_id}] v1.networkAddressGroups.id.get", response, response.Code()) + } +} + +// NewV1NetworkAddressGroupsIDGetOK creates a V1NetworkAddressGroupsIDGetOK with default headers values +func NewV1NetworkAddressGroupsIDGetOK() *V1NetworkAddressGroupsIDGetOK { + return &V1NetworkAddressGroupsIDGetOK{} +} + +/* +V1NetworkAddressGroupsIDGetOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkAddressGroupsIDGetOK struct { + Payload *models.NetworkAddressGroup +} + +// IsSuccess returns true when this v1 network address groups Id get o k response has a 2xx status code +func (o *V1NetworkAddressGroupsIDGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network address groups Id get o k response has a 3xx status code +func (o *V1NetworkAddressGroupsIDGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id get o k response has a 4xx status code +func (o *V1NetworkAddressGroupsIDGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups Id get o k response has a 5xx status code +func (o *V1NetworkAddressGroupsIDGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id get o k response a status code equal to that given +func (o *V1NetworkAddressGroupsIDGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network address groups Id get o k response +func (o *V1NetworkAddressGroupsIDGetOK) Code() int { + return 200 +} + +func (o *V1NetworkAddressGroupsIDGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsIDGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsIDGetOK) GetPayload() *models.NetworkAddressGroup { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkAddressGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsIDGetBadRequest creates a V1NetworkAddressGroupsIDGetBadRequest with default headers values +func NewV1NetworkAddressGroupsIDGetBadRequest() *V1NetworkAddressGroupsIDGetBadRequest { + return &V1NetworkAddressGroupsIDGetBadRequest{} +} + +/* +V1NetworkAddressGroupsIDGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkAddressGroupsIDGetBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id get bad request response has a 2xx status code +func (o *V1NetworkAddressGroupsIDGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id get bad request response has a 3xx status code +func (o *V1NetworkAddressGroupsIDGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id get bad request response has a 4xx status code +func (o *V1NetworkAddressGroupsIDGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id get bad request response has a 5xx status code +func (o *V1NetworkAddressGroupsIDGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id get bad request response a status code equal to that given +func (o *V1NetworkAddressGroupsIDGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network address groups Id get bad request response +func (o *V1NetworkAddressGroupsIDGetBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkAddressGroupsIDGetBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsIDGetBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsIDGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDGetBadRequest) 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 +} + +// NewV1NetworkAddressGroupsIDGetUnauthorized creates a V1NetworkAddressGroupsIDGetUnauthorized with default headers values +func NewV1NetworkAddressGroupsIDGetUnauthorized() *V1NetworkAddressGroupsIDGetUnauthorized { + return &V1NetworkAddressGroupsIDGetUnauthorized{} +} + +/* +V1NetworkAddressGroupsIDGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkAddressGroupsIDGetUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id get unauthorized response has a 2xx status code +func (o *V1NetworkAddressGroupsIDGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id get unauthorized response has a 3xx status code +func (o *V1NetworkAddressGroupsIDGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id get unauthorized response has a 4xx status code +func (o *V1NetworkAddressGroupsIDGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id get unauthorized response has a 5xx status code +func (o *V1NetworkAddressGroupsIDGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id get unauthorized response a status code equal to that given +func (o *V1NetworkAddressGroupsIDGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network address groups Id get unauthorized response +func (o *V1NetworkAddressGroupsIDGetUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkAddressGroupsIDGetUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsIDGetUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsIDGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDGetUnauthorized) 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 +} + +// NewV1NetworkAddressGroupsIDGetForbidden creates a V1NetworkAddressGroupsIDGetForbidden with default headers values +func NewV1NetworkAddressGroupsIDGetForbidden() *V1NetworkAddressGroupsIDGetForbidden { + return &V1NetworkAddressGroupsIDGetForbidden{} +} + +/* +V1NetworkAddressGroupsIDGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkAddressGroupsIDGetForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id get forbidden response has a 2xx status code +func (o *V1NetworkAddressGroupsIDGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id get forbidden response has a 3xx status code +func (o *V1NetworkAddressGroupsIDGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id get forbidden response has a 4xx status code +func (o *V1NetworkAddressGroupsIDGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id get forbidden response has a 5xx status code +func (o *V1NetworkAddressGroupsIDGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id get forbidden response a status code equal to that given +func (o *V1NetworkAddressGroupsIDGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network address groups Id get forbidden response +func (o *V1NetworkAddressGroupsIDGetForbidden) Code() int { + return 403 +} + +func (o *V1NetworkAddressGroupsIDGetForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsIDGetForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsIDGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDGetForbidden) 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 +} + +// NewV1NetworkAddressGroupsIDGetNotFound creates a V1NetworkAddressGroupsIDGetNotFound with default headers values +func NewV1NetworkAddressGroupsIDGetNotFound() *V1NetworkAddressGroupsIDGetNotFound { + return &V1NetworkAddressGroupsIDGetNotFound{} +} + +/* +V1NetworkAddressGroupsIDGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkAddressGroupsIDGetNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id get not found response has a 2xx status code +func (o *V1NetworkAddressGroupsIDGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id get not found response has a 3xx status code +func (o *V1NetworkAddressGroupsIDGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id get not found response has a 4xx status code +func (o *V1NetworkAddressGroupsIDGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id get not found response has a 5xx status code +func (o *V1NetworkAddressGroupsIDGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id get not found response a status code equal to that given +func (o *V1NetworkAddressGroupsIDGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network address groups Id get not found response +func (o *V1NetworkAddressGroupsIDGetNotFound) Code() int { + return 404 +} + +func (o *V1NetworkAddressGroupsIDGetNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsIDGetNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsIDGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDGetNotFound) 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 +} + +// NewV1NetworkAddressGroupsIDGetInternalServerError creates a V1NetworkAddressGroupsIDGetInternalServerError with default headers values +func NewV1NetworkAddressGroupsIDGetInternalServerError() *V1NetworkAddressGroupsIDGetInternalServerError { + return &V1NetworkAddressGroupsIDGetInternalServerError{} +} + +/* +V1NetworkAddressGroupsIDGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkAddressGroupsIDGetInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id get internal server error response has a 2xx status code +func (o *V1NetworkAddressGroupsIDGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id get internal server error response has a 3xx status code +func (o *V1NetworkAddressGroupsIDGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id get internal server error response has a 4xx status code +func (o *V1NetworkAddressGroupsIDGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups Id get internal server error response has a 5xx status code +func (o *V1NetworkAddressGroupsIDGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network address groups Id get internal server error response a status code equal to that given +func (o *V1NetworkAddressGroupsIDGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network address groups Id get internal server error response +func (o *V1NetworkAddressGroupsIDGetInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkAddressGroupsIDGetInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsIDGetInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsIDGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDGetInternalServerError) 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/network_address_groups/v1_network_address_groups_id_put_parameters.go b/power/client/network_address_groups/v1_network_address_groups_id_put_parameters.go new file mode 100644 index 00000000..c09279ba --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_id_put_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// 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" +) + +// NewV1NetworkAddressGroupsIDPutParams creates a new V1NetworkAddressGroupsIDPutParams 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 NewV1NetworkAddressGroupsIDPutParams() *V1NetworkAddressGroupsIDPutParams { + return &V1NetworkAddressGroupsIDPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkAddressGroupsIDPutParamsWithTimeout creates a new V1NetworkAddressGroupsIDPutParams object +// with the ability to set a timeout on a request. +func NewV1NetworkAddressGroupsIDPutParamsWithTimeout(timeout time.Duration) *V1NetworkAddressGroupsIDPutParams { + return &V1NetworkAddressGroupsIDPutParams{ + timeout: timeout, + } +} + +// NewV1NetworkAddressGroupsIDPutParamsWithContext creates a new V1NetworkAddressGroupsIDPutParams object +// with the ability to set a context for a request. +func NewV1NetworkAddressGroupsIDPutParamsWithContext(ctx context.Context) *V1NetworkAddressGroupsIDPutParams { + return &V1NetworkAddressGroupsIDPutParams{ + Context: ctx, + } +} + +// NewV1NetworkAddressGroupsIDPutParamsWithHTTPClient creates a new V1NetworkAddressGroupsIDPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkAddressGroupsIDPutParamsWithHTTPClient(client *http.Client) *V1NetworkAddressGroupsIDPutParams { + return &V1NetworkAddressGroupsIDPutParams{ + HTTPClient: client, + } +} + +/* +V1NetworkAddressGroupsIDPutParams contains all the parameters to send to the API endpoint + + for the v1 network address groups id put operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkAddressGroupsIDPutParams struct { + + /* Body. + + Parameters for the update of a Network Address Group + */ + Body *models.NetworkAddressGroupUpdate + + /* NetworkAddressGroupID. + + Network Address Group ID + */ + NetworkAddressGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network address groups id put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsIDPutParams) WithDefaults() *V1NetworkAddressGroupsIDPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network address groups id put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsIDPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network address groups id put params +func (o *V1NetworkAddressGroupsIDPutParams) WithTimeout(timeout time.Duration) *V1NetworkAddressGroupsIDPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network address groups id put params +func (o *V1NetworkAddressGroupsIDPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network address groups id put params +func (o *V1NetworkAddressGroupsIDPutParams) WithContext(ctx context.Context) *V1NetworkAddressGroupsIDPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network address groups id put params +func (o *V1NetworkAddressGroupsIDPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network address groups id put params +func (o *V1NetworkAddressGroupsIDPutParams) WithHTTPClient(client *http.Client) *V1NetworkAddressGroupsIDPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network address groups id put params +func (o *V1NetworkAddressGroupsIDPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 network address groups id put params +func (o *V1NetworkAddressGroupsIDPutParams) WithBody(body *models.NetworkAddressGroupUpdate) *V1NetworkAddressGroupsIDPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 network address groups id put params +func (o *V1NetworkAddressGroupsIDPutParams) SetBody(body *models.NetworkAddressGroupUpdate) { + o.Body = body +} + +// WithNetworkAddressGroupID adds the networkAddressGroupID to the v1 network address groups id put params +func (o *V1NetworkAddressGroupsIDPutParams) WithNetworkAddressGroupID(networkAddressGroupID string) *V1NetworkAddressGroupsIDPutParams { + o.SetNetworkAddressGroupID(networkAddressGroupID) + return o +} + +// SetNetworkAddressGroupID adds the networkAddressGroupId to the v1 network address groups id put params +func (o *V1NetworkAddressGroupsIDPutParams) SetNetworkAddressGroupID(networkAddressGroupID string) { + o.NetworkAddressGroupID = networkAddressGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkAddressGroupsIDPutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param network_address_group_id + if err := r.SetPathParam("network_address_group_id", o.NetworkAddressGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_address_groups/v1_network_address_groups_id_put_responses.go b/power/client/network_address_groups/v1_network_address_groups_id_put_responses.go new file mode 100644 index 00000000..0c86e3a0 --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_id_put_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// 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" +) + +// V1NetworkAddressGroupsIDPutReader is a Reader for the V1NetworkAddressGroupsIDPut structure. +type V1NetworkAddressGroupsIDPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkAddressGroupsIDPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkAddressGroupsIDPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkAddressGroupsIDPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkAddressGroupsIDPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkAddressGroupsIDPutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkAddressGroupsIDPutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkAddressGroupsIDPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /v1/network-address-groups/{network_address_group_id}] v1.networkAddressGroups.id.put", response, response.Code()) + } +} + +// NewV1NetworkAddressGroupsIDPutOK creates a V1NetworkAddressGroupsIDPutOK with default headers values +func NewV1NetworkAddressGroupsIDPutOK() *V1NetworkAddressGroupsIDPutOK { + return &V1NetworkAddressGroupsIDPutOK{} +} + +/* +V1NetworkAddressGroupsIDPutOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkAddressGroupsIDPutOK struct { + Payload *models.NetworkAddressGroup +} + +// IsSuccess returns true when this v1 network address groups Id put o k response has a 2xx status code +func (o *V1NetworkAddressGroupsIDPutOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network address groups Id put o k response has a 3xx status code +func (o *V1NetworkAddressGroupsIDPutOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id put o k response has a 4xx status code +func (o *V1NetworkAddressGroupsIDPutOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups Id put o k response has a 5xx status code +func (o *V1NetworkAddressGroupsIDPutOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id put o k response a status code equal to that given +func (o *V1NetworkAddressGroupsIDPutOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network address groups Id put o k response +func (o *V1NetworkAddressGroupsIDPutOK) Code() int { + return 200 +} + +func (o *V1NetworkAddressGroupsIDPutOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsIDPutOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsIDPutOK) GetPayload() *models.NetworkAddressGroup { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkAddressGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsIDPutBadRequest creates a V1NetworkAddressGroupsIDPutBadRequest with default headers values +func NewV1NetworkAddressGroupsIDPutBadRequest() *V1NetworkAddressGroupsIDPutBadRequest { + return &V1NetworkAddressGroupsIDPutBadRequest{} +} + +/* +V1NetworkAddressGroupsIDPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkAddressGroupsIDPutBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id put bad request response has a 2xx status code +func (o *V1NetworkAddressGroupsIDPutBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id put bad request response has a 3xx status code +func (o *V1NetworkAddressGroupsIDPutBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id put bad request response has a 4xx status code +func (o *V1NetworkAddressGroupsIDPutBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id put bad request response has a 5xx status code +func (o *V1NetworkAddressGroupsIDPutBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id put bad request response a status code equal to that given +func (o *V1NetworkAddressGroupsIDPutBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network address groups Id put bad request response +func (o *V1NetworkAddressGroupsIDPutBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkAddressGroupsIDPutBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsIDPutBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsIDPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDPutBadRequest) 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 +} + +// NewV1NetworkAddressGroupsIDPutUnauthorized creates a V1NetworkAddressGroupsIDPutUnauthorized with default headers values +func NewV1NetworkAddressGroupsIDPutUnauthorized() *V1NetworkAddressGroupsIDPutUnauthorized { + return &V1NetworkAddressGroupsIDPutUnauthorized{} +} + +/* +V1NetworkAddressGroupsIDPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkAddressGroupsIDPutUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id put unauthorized response has a 2xx status code +func (o *V1NetworkAddressGroupsIDPutUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id put unauthorized response has a 3xx status code +func (o *V1NetworkAddressGroupsIDPutUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id put unauthorized response has a 4xx status code +func (o *V1NetworkAddressGroupsIDPutUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id put unauthorized response has a 5xx status code +func (o *V1NetworkAddressGroupsIDPutUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id put unauthorized response a status code equal to that given +func (o *V1NetworkAddressGroupsIDPutUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network address groups Id put unauthorized response +func (o *V1NetworkAddressGroupsIDPutUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkAddressGroupsIDPutUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsIDPutUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsIDPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDPutUnauthorized) 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 +} + +// NewV1NetworkAddressGroupsIDPutForbidden creates a V1NetworkAddressGroupsIDPutForbidden with default headers values +func NewV1NetworkAddressGroupsIDPutForbidden() *V1NetworkAddressGroupsIDPutForbidden { + return &V1NetworkAddressGroupsIDPutForbidden{} +} + +/* +V1NetworkAddressGroupsIDPutForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkAddressGroupsIDPutForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id put forbidden response has a 2xx status code +func (o *V1NetworkAddressGroupsIDPutForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id put forbidden response has a 3xx status code +func (o *V1NetworkAddressGroupsIDPutForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id put forbidden response has a 4xx status code +func (o *V1NetworkAddressGroupsIDPutForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id put forbidden response has a 5xx status code +func (o *V1NetworkAddressGroupsIDPutForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id put forbidden response a status code equal to that given +func (o *V1NetworkAddressGroupsIDPutForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network address groups Id put forbidden response +func (o *V1NetworkAddressGroupsIDPutForbidden) Code() int { + return 403 +} + +func (o *V1NetworkAddressGroupsIDPutForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsIDPutForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsIDPutForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDPutForbidden) 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 +} + +// NewV1NetworkAddressGroupsIDPutNotFound creates a V1NetworkAddressGroupsIDPutNotFound with default headers values +func NewV1NetworkAddressGroupsIDPutNotFound() *V1NetworkAddressGroupsIDPutNotFound { + return &V1NetworkAddressGroupsIDPutNotFound{} +} + +/* +V1NetworkAddressGroupsIDPutNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkAddressGroupsIDPutNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id put not found response has a 2xx status code +func (o *V1NetworkAddressGroupsIDPutNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id put not found response has a 3xx status code +func (o *V1NetworkAddressGroupsIDPutNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id put not found response has a 4xx status code +func (o *V1NetworkAddressGroupsIDPutNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id put not found response has a 5xx status code +func (o *V1NetworkAddressGroupsIDPutNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id put not found response a status code equal to that given +func (o *V1NetworkAddressGroupsIDPutNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network address groups Id put not found response +func (o *V1NetworkAddressGroupsIDPutNotFound) Code() int { + return 404 +} + +func (o *V1NetworkAddressGroupsIDPutNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsIDPutNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsIDPutNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDPutNotFound) 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 +} + +// NewV1NetworkAddressGroupsIDPutInternalServerError creates a V1NetworkAddressGroupsIDPutInternalServerError with default headers values +func NewV1NetworkAddressGroupsIDPutInternalServerError() *V1NetworkAddressGroupsIDPutInternalServerError { + return &V1NetworkAddressGroupsIDPutInternalServerError{} +} + +/* +V1NetworkAddressGroupsIDPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkAddressGroupsIDPutInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id put internal server error response has a 2xx status code +func (o *V1NetworkAddressGroupsIDPutInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id put internal server error response has a 3xx status code +func (o *V1NetworkAddressGroupsIDPutInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id put internal server error response has a 4xx status code +func (o *V1NetworkAddressGroupsIDPutInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups Id put internal server error response has a 5xx status code +func (o *V1NetworkAddressGroupsIDPutInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network address groups Id put internal server error response a status code equal to that given +func (o *V1NetworkAddressGroupsIDPutInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network address groups Id put internal server error response +func (o *V1NetworkAddressGroupsIDPutInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkAddressGroupsIDPutInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsIDPutInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsIDPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDPutInternalServerError) 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/network_address_groups/v1_network_address_groups_members_delete_parameters.go b/power/client/network_address_groups/v1_network_address_groups_members_delete_parameters.go new file mode 100644 index 00000000..9351b40f --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_members_delete_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// 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" +) + +// NewV1NetworkAddressGroupsMembersDeleteParams creates a new V1NetworkAddressGroupsMembersDeleteParams 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 NewV1NetworkAddressGroupsMembersDeleteParams() *V1NetworkAddressGroupsMembersDeleteParams { + return &V1NetworkAddressGroupsMembersDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkAddressGroupsMembersDeleteParamsWithTimeout creates a new V1NetworkAddressGroupsMembersDeleteParams object +// with the ability to set a timeout on a request. +func NewV1NetworkAddressGroupsMembersDeleteParamsWithTimeout(timeout time.Duration) *V1NetworkAddressGroupsMembersDeleteParams { + return &V1NetworkAddressGroupsMembersDeleteParams{ + timeout: timeout, + } +} + +// NewV1NetworkAddressGroupsMembersDeleteParamsWithContext creates a new V1NetworkAddressGroupsMembersDeleteParams object +// with the ability to set a context for a request. +func NewV1NetworkAddressGroupsMembersDeleteParamsWithContext(ctx context.Context) *V1NetworkAddressGroupsMembersDeleteParams { + return &V1NetworkAddressGroupsMembersDeleteParams{ + Context: ctx, + } +} + +// NewV1NetworkAddressGroupsMembersDeleteParamsWithHTTPClient creates a new V1NetworkAddressGroupsMembersDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkAddressGroupsMembersDeleteParamsWithHTTPClient(client *http.Client) *V1NetworkAddressGroupsMembersDeleteParams { + return &V1NetworkAddressGroupsMembersDeleteParams{ + HTTPClient: client, + } +} + +/* +V1NetworkAddressGroupsMembersDeleteParams contains all the parameters to send to the API endpoint + + for the v1 network address groups members delete operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkAddressGroupsMembersDeleteParams struct { + + /* NetworkAddressGroupID. + + Network Address Group ID + */ + NetworkAddressGroupID string + + /* NetworkAddressGroupMemberID. + + The Network Address Group Member ID + */ + NetworkAddressGroupMemberID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network address groups members delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsMembersDeleteParams) WithDefaults() *V1NetworkAddressGroupsMembersDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network address groups members delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsMembersDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network address groups members delete params +func (o *V1NetworkAddressGroupsMembersDeleteParams) WithTimeout(timeout time.Duration) *V1NetworkAddressGroupsMembersDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network address groups members delete params +func (o *V1NetworkAddressGroupsMembersDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network address groups members delete params +func (o *V1NetworkAddressGroupsMembersDeleteParams) WithContext(ctx context.Context) *V1NetworkAddressGroupsMembersDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network address groups members delete params +func (o *V1NetworkAddressGroupsMembersDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network address groups members delete params +func (o *V1NetworkAddressGroupsMembersDeleteParams) WithHTTPClient(client *http.Client) *V1NetworkAddressGroupsMembersDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network address groups members delete params +func (o *V1NetworkAddressGroupsMembersDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNetworkAddressGroupID adds the networkAddressGroupID to the v1 network address groups members delete params +func (o *V1NetworkAddressGroupsMembersDeleteParams) WithNetworkAddressGroupID(networkAddressGroupID string) *V1NetworkAddressGroupsMembersDeleteParams { + o.SetNetworkAddressGroupID(networkAddressGroupID) + return o +} + +// SetNetworkAddressGroupID adds the networkAddressGroupId to the v1 network address groups members delete params +func (o *V1NetworkAddressGroupsMembersDeleteParams) SetNetworkAddressGroupID(networkAddressGroupID string) { + o.NetworkAddressGroupID = networkAddressGroupID +} + +// WithNetworkAddressGroupMemberID adds the networkAddressGroupMemberID to the v1 network address groups members delete params +func (o *V1NetworkAddressGroupsMembersDeleteParams) WithNetworkAddressGroupMemberID(networkAddressGroupMemberID string) *V1NetworkAddressGroupsMembersDeleteParams { + o.SetNetworkAddressGroupMemberID(networkAddressGroupMemberID) + return o +} + +// SetNetworkAddressGroupMemberID adds the networkAddressGroupMemberId to the v1 network address groups members delete params +func (o *V1NetworkAddressGroupsMembersDeleteParams) SetNetworkAddressGroupMemberID(networkAddressGroupMemberID string) { + o.NetworkAddressGroupMemberID = networkAddressGroupMemberID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkAddressGroupsMembersDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param network_address_group_id + if err := r.SetPathParam("network_address_group_id", o.NetworkAddressGroupID); err != nil { + return err + } + + // path param network_address_group_member_id + if err := r.SetPathParam("network_address_group_member_id", o.NetworkAddressGroupMemberID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_address_groups/v1_network_address_groups_members_delete_responses.go b/power/client/network_address_groups/v1_network_address_groups_members_delete_responses.go new file mode 100644 index 00000000..86199912 --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_members_delete_responses.go @@ -0,0 +1,562 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// 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" +) + +// V1NetworkAddressGroupsMembersDeleteReader is a Reader for the V1NetworkAddressGroupsMembersDelete structure. +type V1NetworkAddressGroupsMembersDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkAddressGroupsMembersDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkAddressGroupsMembersDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkAddressGroupsMembersDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkAddressGroupsMembersDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkAddressGroupsMembersDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkAddressGroupsMembersDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkAddressGroupsMembersDeleteConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkAddressGroupsMembersDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}] v1.networkAddressGroups.members.delete", response, response.Code()) + } +} + +// NewV1NetworkAddressGroupsMembersDeleteOK creates a V1NetworkAddressGroupsMembersDeleteOK with default headers values +func NewV1NetworkAddressGroupsMembersDeleteOK() *V1NetworkAddressGroupsMembersDeleteOK { + return &V1NetworkAddressGroupsMembersDeleteOK{} +} + +/* +V1NetworkAddressGroupsMembersDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkAddressGroupsMembersDeleteOK struct { + Payload *models.NetworkAddressGroup +} + +// IsSuccess returns true when this v1 network address groups members delete o k response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network address groups members delete o k response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members delete o k response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups members delete o k response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members delete o k response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network address groups members delete o k response +func (o *V1NetworkAddressGroupsMembersDeleteOK) Code() int { + return 200 +} + +func (o *V1NetworkAddressGroupsMembersDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteOK) GetPayload() *models.NetworkAddressGroup { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkAddressGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsMembersDeleteBadRequest creates a V1NetworkAddressGroupsMembersDeleteBadRequest with default headers values +func NewV1NetworkAddressGroupsMembersDeleteBadRequest() *V1NetworkAddressGroupsMembersDeleteBadRequest { + return &V1NetworkAddressGroupsMembersDeleteBadRequest{} +} + +/* +V1NetworkAddressGroupsMembersDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkAddressGroupsMembersDeleteBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members delete bad request response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members delete bad request response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members delete bad request response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members delete bad request response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members delete bad request response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network address groups members delete bad request response +func (o *V1NetworkAddressGroupsMembersDeleteBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkAddressGroupsMembersDeleteBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersDeleteBadRequest) 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 +} + +// NewV1NetworkAddressGroupsMembersDeleteUnauthorized creates a V1NetworkAddressGroupsMembersDeleteUnauthorized with default headers values +func NewV1NetworkAddressGroupsMembersDeleteUnauthorized() *V1NetworkAddressGroupsMembersDeleteUnauthorized { + return &V1NetworkAddressGroupsMembersDeleteUnauthorized{} +} + +/* +V1NetworkAddressGroupsMembersDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkAddressGroupsMembersDeleteUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members delete unauthorized response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members delete unauthorized response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members delete unauthorized response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members delete unauthorized response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members delete unauthorized response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network address groups members delete unauthorized response +func (o *V1NetworkAddressGroupsMembersDeleteUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkAddressGroupsMembersDeleteUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersDeleteUnauthorized) 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 +} + +// NewV1NetworkAddressGroupsMembersDeleteForbidden creates a V1NetworkAddressGroupsMembersDeleteForbidden with default headers values +func NewV1NetworkAddressGroupsMembersDeleteForbidden() *V1NetworkAddressGroupsMembersDeleteForbidden { + return &V1NetworkAddressGroupsMembersDeleteForbidden{} +} + +/* +V1NetworkAddressGroupsMembersDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkAddressGroupsMembersDeleteForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members delete forbidden response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members delete forbidden response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members delete forbidden response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members delete forbidden response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members delete forbidden response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network address groups members delete forbidden response +func (o *V1NetworkAddressGroupsMembersDeleteForbidden) Code() int { + return 403 +} + +func (o *V1NetworkAddressGroupsMembersDeleteForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersDeleteForbidden) 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 +} + +// NewV1NetworkAddressGroupsMembersDeleteNotFound creates a V1NetworkAddressGroupsMembersDeleteNotFound with default headers values +func NewV1NetworkAddressGroupsMembersDeleteNotFound() *V1NetworkAddressGroupsMembersDeleteNotFound { + return &V1NetworkAddressGroupsMembersDeleteNotFound{} +} + +/* +V1NetworkAddressGroupsMembersDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkAddressGroupsMembersDeleteNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members delete not found response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members delete not found response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members delete not found response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members delete not found response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members delete not found response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network address groups members delete not found response +func (o *V1NetworkAddressGroupsMembersDeleteNotFound) Code() int { + return 404 +} + +func (o *V1NetworkAddressGroupsMembersDeleteNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersDeleteNotFound) 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 +} + +// NewV1NetworkAddressGroupsMembersDeleteConflict creates a V1NetworkAddressGroupsMembersDeleteConflict with default headers values +func NewV1NetworkAddressGroupsMembersDeleteConflict() *V1NetworkAddressGroupsMembersDeleteConflict { + return &V1NetworkAddressGroupsMembersDeleteConflict{} +} + +/* +V1NetworkAddressGroupsMembersDeleteConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkAddressGroupsMembersDeleteConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members delete conflict response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersDeleteConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members delete conflict response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersDeleteConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members delete conflict response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersDeleteConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members delete conflict response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersDeleteConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members delete conflict response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersDeleteConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network address groups members delete conflict response +func (o *V1NetworkAddressGroupsMembersDeleteConflict) Code() int { + return 409 +} + +func (o *V1NetworkAddressGroupsMembersDeleteConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteConflict %s", 409, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteConflict %s", 409, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersDeleteConflict) 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 +} + +// NewV1NetworkAddressGroupsMembersDeleteInternalServerError creates a V1NetworkAddressGroupsMembersDeleteInternalServerError with default headers values +func NewV1NetworkAddressGroupsMembersDeleteInternalServerError() *V1NetworkAddressGroupsMembersDeleteInternalServerError { + return &V1NetworkAddressGroupsMembersDeleteInternalServerError{} +} + +/* +V1NetworkAddressGroupsMembersDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkAddressGroupsMembersDeleteInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members delete internal server error response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members delete internal server error response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members delete internal server error response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups members delete internal server error response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network address groups members delete internal server error response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network address groups members delete internal server error response +func (o *V1NetworkAddressGroupsMembersDeleteInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkAddressGroupsMembersDeleteInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersDeleteInternalServerError) 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/network_address_groups/v1_network_address_groups_members_post_parameters.go b/power/client/network_address_groups/v1_network_address_groups_members_post_parameters.go new file mode 100644 index 00000000..b178cd0f --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_members_post_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// 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" +) + +// NewV1NetworkAddressGroupsMembersPostParams creates a new V1NetworkAddressGroupsMembersPostParams 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 NewV1NetworkAddressGroupsMembersPostParams() *V1NetworkAddressGroupsMembersPostParams { + return &V1NetworkAddressGroupsMembersPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkAddressGroupsMembersPostParamsWithTimeout creates a new V1NetworkAddressGroupsMembersPostParams object +// with the ability to set a timeout on a request. +func NewV1NetworkAddressGroupsMembersPostParamsWithTimeout(timeout time.Duration) *V1NetworkAddressGroupsMembersPostParams { + return &V1NetworkAddressGroupsMembersPostParams{ + timeout: timeout, + } +} + +// NewV1NetworkAddressGroupsMembersPostParamsWithContext creates a new V1NetworkAddressGroupsMembersPostParams object +// with the ability to set a context for a request. +func NewV1NetworkAddressGroupsMembersPostParamsWithContext(ctx context.Context) *V1NetworkAddressGroupsMembersPostParams { + return &V1NetworkAddressGroupsMembersPostParams{ + Context: ctx, + } +} + +// NewV1NetworkAddressGroupsMembersPostParamsWithHTTPClient creates a new V1NetworkAddressGroupsMembersPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkAddressGroupsMembersPostParamsWithHTTPClient(client *http.Client) *V1NetworkAddressGroupsMembersPostParams { + return &V1NetworkAddressGroupsMembersPostParams{ + HTTPClient: client, + } +} + +/* +V1NetworkAddressGroupsMembersPostParams contains all the parameters to send to the API endpoint + + for the v1 network address groups members post operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkAddressGroupsMembersPostParams struct { + + /* Body. + + Parameters for adding a member to a Network Address Group + */ + Body *models.NetworkAddressGroupAddMember + + /* NetworkAddressGroupID. + + Network Address Group ID + */ + NetworkAddressGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network address groups members post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsMembersPostParams) WithDefaults() *V1NetworkAddressGroupsMembersPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network address groups members post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsMembersPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network address groups members post params +func (o *V1NetworkAddressGroupsMembersPostParams) WithTimeout(timeout time.Duration) *V1NetworkAddressGroupsMembersPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network address groups members post params +func (o *V1NetworkAddressGroupsMembersPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network address groups members post params +func (o *V1NetworkAddressGroupsMembersPostParams) WithContext(ctx context.Context) *V1NetworkAddressGroupsMembersPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network address groups members post params +func (o *V1NetworkAddressGroupsMembersPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network address groups members post params +func (o *V1NetworkAddressGroupsMembersPostParams) WithHTTPClient(client *http.Client) *V1NetworkAddressGroupsMembersPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network address groups members post params +func (o *V1NetworkAddressGroupsMembersPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 network address groups members post params +func (o *V1NetworkAddressGroupsMembersPostParams) WithBody(body *models.NetworkAddressGroupAddMember) *V1NetworkAddressGroupsMembersPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 network address groups members post params +func (o *V1NetworkAddressGroupsMembersPostParams) SetBody(body *models.NetworkAddressGroupAddMember) { + o.Body = body +} + +// WithNetworkAddressGroupID adds the networkAddressGroupID to the v1 network address groups members post params +func (o *V1NetworkAddressGroupsMembersPostParams) WithNetworkAddressGroupID(networkAddressGroupID string) *V1NetworkAddressGroupsMembersPostParams { + o.SetNetworkAddressGroupID(networkAddressGroupID) + return o +} + +// SetNetworkAddressGroupID adds the networkAddressGroupId to the v1 network address groups members post params +func (o *V1NetworkAddressGroupsMembersPostParams) SetNetworkAddressGroupID(networkAddressGroupID string) { + o.NetworkAddressGroupID = networkAddressGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkAddressGroupsMembersPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param network_address_group_id + if err := r.SetPathParam("network_address_group_id", o.NetworkAddressGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_address_groups/v1_network_address_groups_members_post_responses.go b/power/client/network_address_groups/v1_network_address_groups_members_post_responses.go new file mode 100644 index 00000000..76f6e5e0 --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_members_post_responses.go @@ -0,0 +1,638 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// 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" +) + +// V1NetworkAddressGroupsMembersPostReader is a Reader for the V1NetworkAddressGroupsMembersPost structure. +type V1NetworkAddressGroupsMembersPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkAddressGroupsMembersPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkAddressGroupsMembersPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkAddressGroupsMembersPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkAddressGroupsMembersPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkAddressGroupsMembersPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkAddressGroupsMembersPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkAddressGroupsMembersPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewV1NetworkAddressGroupsMembersPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkAddressGroupsMembersPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /v1/network-address-groups/{network_address_group_id}/members] v1.networkAddressGroups.members.post", response, response.Code()) + } +} + +// NewV1NetworkAddressGroupsMembersPostOK creates a V1NetworkAddressGroupsMembersPostOK with default headers values +func NewV1NetworkAddressGroupsMembersPostOK() *V1NetworkAddressGroupsMembersPostOK { + return &V1NetworkAddressGroupsMembersPostOK{} +} + +/* +V1NetworkAddressGroupsMembersPostOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkAddressGroupsMembersPostOK struct { + Payload *models.NetworkAddressGroup +} + +// IsSuccess returns true when this v1 network address groups members post o k response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersPostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network address groups members post o k response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersPostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members post o k response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersPostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups members post o k response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersPostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members post o k response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersPostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network address groups members post o k response +func (o *V1NetworkAddressGroupsMembersPostOK) Code() int { + return 200 +} + +func (o *V1NetworkAddressGroupsMembersPostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostOK) GetPayload() *models.NetworkAddressGroup { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkAddressGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsMembersPostBadRequest creates a V1NetworkAddressGroupsMembersPostBadRequest with default headers values +func NewV1NetworkAddressGroupsMembersPostBadRequest() *V1NetworkAddressGroupsMembersPostBadRequest { + return &V1NetworkAddressGroupsMembersPostBadRequest{} +} + +/* +V1NetworkAddressGroupsMembersPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkAddressGroupsMembersPostBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members post bad request response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members post bad request response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members post bad request response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members post bad request response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members post bad request response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network address groups members post bad request response +func (o *V1NetworkAddressGroupsMembersPostBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkAddressGroupsMembersPostBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersPostBadRequest) 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 +} + +// NewV1NetworkAddressGroupsMembersPostUnauthorized creates a V1NetworkAddressGroupsMembersPostUnauthorized with default headers values +func NewV1NetworkAddressGroupsMembersPostUnauthorized() *V1NetworkAddressGroupsMembersPostUnauthorized { + return &V1NetworkAddressGroupsMembersPostUnauthorized{} +} + +/* +V1NetworkAddressGroupsMembersPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkAddressGroupsMembersPostUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members post unauthorized response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members post unauthorized response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members post unauthorized response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members post unauthorized response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members post unauthorized response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network address groups members post unauthorized response +func (o *V1NetworkAddressGroupsMembersPostUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkAddressGroupsMembersPostUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersPostUnauthorized) 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 +} + +// NewV1NetworkAddressGroupsMembersPostForbidden creates a V1NetworkAddressGroupsMembersPostForbidden with default headers values +func NewV1NetworkAddressGroupsMembersPostForbidden() *V1NetworkAddressGroupsMembersPostForbidden { + return &V1NetworkAddressGroupsMembersPostForbidden{} +} + +/* +V1NetworkAddressGroupsMembersPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkAddressGroupsMembersPostForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members post forbidden response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members post forbidden response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members post forbidden response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members post forbidden response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members post forbidden response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network address groups members post forbidden response +func (o *V1NetworkAddressGroupsMembersPostForbidden) Code() int { + return 403 +} + +func (o *V1NetworkAddressGroupsMembersPostForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersPostForbidden) 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 +} + +// NewV1NetworkAddressGroupsMembersPostNotFound creates a V1NetworkAddressGroupsMembersPostNotFound with default headers values +func NewV1NetworkAddressGroupsMembersPostNotFound() *V1NetworkAddressGroupsMembersPostNotFound { + return &V1NetworkAddressGroupsMembersPostNotFound{} +} + +/* +V1NetworkAddressGroupsMembersPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkAddressGroupsMembersPostNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members post not found response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersPostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members post not found response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersPostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members post not found response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersPostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members post not found response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersPostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members post not found response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersPostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network address groups members post not found response +func (o *V1NetworkAddressGroupsMembersPostNotFound) Code() int { + return 404 +} + +func (o *V1NetworkAddressGroupsMembersPostNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersPostNotFound) 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 +} + +// NewV1NetworkAddressGroupsMembersPostConflict creates a V1NetworkAddressGroupsMembersPostConflict with default headers values +func NewV1NetworkAddressGroupsMembersPostConflict() *V1NetworkAddressGroupsMembersPostConflict { + return &V1NetworkAddressGroupsMembersPostConflict{} +} + +/* +V1NetworkAddressGroupsMembersPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkAddressGroupsMembersPostConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members post conflict response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members post conflict response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members post conflict response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members post conflict response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members post conflict response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network address groups members post conflict response +func (o *V1NetworkAddressGroupsMembersPostConflict) Code() int { + return 409 +} + +func (o *V1NetworkAddressGroupsMembersPostConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostConflict %s", 409, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostConflict %s", 409, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersPostConflict) 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 +} + +// NewV1NetworkAddressGroupsMembersPostUnprocessableEntity creates a V1NetworkAddressGroupsMembersPostUnprocessableEntity with default headers values +func NewV1NetworkAddressGroupsMembersPostUnprocessableEntity() *V1NetworkAddressGroupsMembersPostUnprocessableEntity { + return &V1NetworkAddressGroupsMembersPostUnprocessableEntity{} +} + +/* +V1NetworkAddressGroupsMembersPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type V1NetworkAddressGroupsMembersPostUnprocessableEntity struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members post unprocessable entity response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersPostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members post unprocessable entity response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersPostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members post unprocessable entity response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersPostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members post unprocessable entity response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersPostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members post unprocessable entity response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersPostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the v1 network address groups members post unprocessable entity response +func (o *V1NetworkAddressGroupsMembersPostUnprocessableEntity) Code() int { + return 422 +} + +func (o *V1NetworkAddressGroupsMembersPostUnprocessableEntity) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostUnprocessableEntity) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersPostUnprocessableEntity) 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 +} + +// NewV1NetworkAddressGroupsMembersPostInternalServerError creates a V1NetworkAddressGroupsMembersPostInternalServerError with default headers values +func NewV1NetworkAddressGroupsMembersPostInternalServerError() *V1NetworkAddressGroupsMembersPostInternalServerError { + return &V1NetworkAddressGroupsMembersPostInternalServerError{} +} + +/* +V1NetworkAddressGroupsMembersPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkAddressGroupsMembersPostInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members post internal server error response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members post internal server error response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members post internal server error response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups members post internal server error response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network address groups members post internal server error response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network address groups members post internal server error response +func (o *V1NetworkAddressGroupsMembersPostInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkAddressGroupsMembersPostInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersPostInternalServerError) 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/network_address_groups/v1_network_address_groups_post_parameters.go b/power/client/network_address_groups/v1_network_address_groups_post_parameters.go new file mode 100644 index 00000000..508919b2 --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_post_parameters.go @@ -0,0 +1,153 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// 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" +) + +// NewV1NetworkAddressGroupsPostParams creates a new V1NetworkAddressGroupsPostParams 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 NewV1NetworkAddressGroupsPostParams() *V1NetworkAddressGroupsPostParams { + return &V1NetworkAddressGroupsPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkAddressGroupsPostParamsWithTimeout creates a new V1NetworkAddressGroupsPostParams object +// with the ability to set a timeout on a request. +func NewV1NetworkAddressGroupsPostParamsWithTimeout(timeout time.Duration) *V1NetworkAddressGroupsPostParams { + return &V1NetworkAddressGroupsPostParams{ + timeout: timeout, + } +} + +// NewV1NetworkAddressGroupsPostParamsWithContext creates a new V1NetworkAddressGroupsPostParams object +// with the ability to set a context for a request. +func NewV1NetworkAddressGroupsPostParamsWithContext(ctx context.Context) *V1NetworkAddressGroupsPostParams { + return &V1NetworkAddressGroupsPostParams{ + Context: ctx, + } +} + +// NewV1NetworkAddressGroupsPostParamsWithHTTPClient creates a new V1NetworkAddressGroupsPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkAddressGroupsPostParamsWithHTTPClient(client *http.Client) *V1NetworkAddressGroupsPostParams { + return &V1NetworkAddressGroupsPostParams{ + HTTPClient: client, + } +} + +/* +V1NetworkAddressGroupsPostParams contains all the parameters to send to the API endpoint + + for the v1 network address groups post operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkAddressGroupsPostParams struct { + + /* Body. + + Parameters for the creation of a Network Address Group + */ + Body *models.NetworkAddressGroupCreate + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network address groups post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsPostParams) WithDefaults() *V1NetworkAddressGroupsPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network address groups post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network address groups post params +func (o *V1NetworkAddressGroupsPostParams) WithTimeout(timeout time.Duration) *V1NetworkAddressGroupsPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network address groups post params +func (o *V1NetworkAddressGroupsPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network address groups post params +func (o *V1NetworkAddressGroupsPostParams) WithContext(ctx context.Context) *V1NetworkAddressGroupsPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network address groups post params +func (o *V1NetworkAddressGroupsPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network address groups post params +func (o *V1NetworkAddressGroupsPostParams) WithHTTPClient(client *http.Client) *V1NetworkAddressGroupsPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network address groups post params +func (o *V1NetworkAddressGroupsPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 network address groups post params +func (o *V1NetworkAddressGroupsPostParams) WithBody(body *models.NetworkAddressGroupCreate) *V1NetworkAddressGroupsPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 network address groups post params +func (o *V1NetworkAddressGroupsPostParams) SetBody(body *models.NetworkAddressGroupCreate) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkAddressGroupsPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_address_groups/v1_network_address_groups_post_responses.go b/power/client/network_address_groups/v1_network_address_groups_post_responses.go new file mode 100644 index 00000000..2a7b9597 --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_post_responses.go @@ -0,0 +1,714 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// 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" +) + +// V1NetworkAddressGroupsPostReader is a Reader for the V1NetworkAddressGroupsPost structure. +type V1NetworkAddressGroupsPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkAddressGroupsPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkAddressGroupsPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 201: + result := NewV1NetworkAddressGroupsPostCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkAddressGroupsPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkAddressGroupsPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkAddressGroupsPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkAddressGroupsPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkAddressGroupsPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewV1NetworkAddressGroupsPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkAddressGroupsPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /v1/network-address-groups] v1.networkAddressGroups.post", response, response.Code()) + } +} + +// NewV1NetworkAddressGroupsPostOK creates a V1NetworkAddressGroupsPostOK with default headers values +func NewV1NetworkAddressGroupsPostOK() *V1NetworkAddressGroupsPostOK { + return &V1NetworkAddressGroupsPostOK{} +} + +/* +V1NetworkAddressGroupsPostOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkAddressGroupsPostOK struct { + Payload *models.NetworkAddressGroup +} + +// IsSuccess returns true when this v1 network address groups post o k response has a 2xx status code +func (o *V1NetworkAddressGroupsPostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network address groups post o k response has a 3xx status code +func (o *V1NetworkAddressGroupsPostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups post o k response has a 4xx status code +func (o *V1NetworkAddressGroupsPostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups post o k response has a 5xx status code +func (o *V1NetworkAddressGroupsPostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups post o k response a status code equal to that given +func (o *V1NetworkAddressGroupsPostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network address groups post o k response +func (o *V1NetworkAddressGroupsPostOK) Code() int { + return 200 +} + +func (o *V1NetworkAddressGroupsPostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsPostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsPostOK) GetPayload() *models.NetworkAddressGroup { + return o.Payload +} + +func (o *V1NetworkAddressGroupsPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkAddressGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsPostCreated creates a V1NetworkAddressGroupsPostCreated with default headers values +func NewV1NetworkAddressGroupsPostCreated() *V1NetworkAddressGroupsPostCreated { + return &V1NetworkAddressGroupsPostCreated{} +} + +/* +V1NetworkAddressGroupsPostCreated describes a response with status code 201, with default header values. + +Created +*/ +type V1NetworkAddressGroupsPostCreated struct { + Payload *models.NetworkAddressGroup +} + +// IsSuccess returns true when this v1 network address groups post created response has a 2xx status code +func (o *V1NetworkAddressGroupsPostCreated) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network address groups post created response has a 3xx status code +func (o *V1NetworkAddressGroupsPostCreated) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups post created response has a 4xx status code +func (o *V1NetworkAddressGroupsPostCreated) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups post created response has a 5xx status code +func (o *V1NetworkAddressGroupsPostCreated) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups post created response a status code equal to that given +func (o *V1NetworkAddressGroupsPostCreated) IsCode(code int) bool { + return code == 201 +} + +// Code gets the status code for the v1 network address groups post created response +func (o *V1NetworkAddressGroupsPostCreated) Code() int { + return 201 +} + +func (o *V1NetworkAddressGroupsPostCreated) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostCreated %s", 201, payload) +} + +func (o *V1NetworkAddressGroupsPostCreated) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostCreated %s", 201, payload) +} + +func (o *V1NetworkAddressGroupsPostCreated) GetPayload() *models.NetworkAddressGroup { + return o.Payload +} + +func (o *V1NetworkAddressGroupsPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkAddressGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsPostBadRequest creates a V1NetworkAddressGroupsPostBadRequest with default headers values +func NewV1NetworkAddressGroupsPostBadRequest() *V1NetworkAddressGroupsPostBadRequest { + return &V1NetworkAddressGroupsPostBadRequest{} +} + +/* +V1NetworkAddressGroupsPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkAddressGroupsPostBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups post bad request response has a 2xx status code +func (o *V1NetworkAddressGroupsPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups post bad request response has a 3xx status code +func (o *V1NetworkAddressGroupsPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups post bad request response has a 4xx status code +func (o *V1NetworkAddressGroupsPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups post bad request response has a 5xx status code +func (o *V1NetworkAddressGroupsPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups post bad request response a status code equal to that given +func (o *V1NetworkAddressGroupsPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network address groups post bad request response +func (o *V1NetworkAddressGroupsPostBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkAddressGroupsPostBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsPostBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsPostBadRequest) 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 +} + +// NewV1NetworkAddressGroupsPostUnauthorized creates a V1NetworkAddressGroupsPostUnauthorized with default headers values +func NewV1NetworkAddressGroupsPostUnauthorized() *V1NetworkAddressGroupsPostUnauthorized { + return &V1NetworkAddressGroupsPostUnauthorized{} +} + +/* +V1NetworkAddressGroupsPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkAddressGroupsPostUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups post unauthorized response has a 2xx status code +func (o *V1NetworkAddressGroupsPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups post unauthorized response has a 3xx status code +func (o *V1NetworkAddressGroupsPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups post unauthorized response has a 4xx status code +func (o *V1NetworkAddressGroupsPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups post unauthorized response has a 5xx status code +func (o *V1NetworkAddressGroupsPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups post unauthorized response a status code equal to that given +func (o *V1NetworkAddressGroupsPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network address groups post unauthorized response +func (o *V1NetworkAddressGroupsPostUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkAddressGroupsPostUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsPostUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsPostUnauthorized) 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 +} + +// NewV1NetworkAddressGroupsPostForbidden creates a V1NetworkAddressGroupsPostForbidden with default headers values +func NewV1NetworkAddressGroupsPostForbidden() *V1NetworkAddressGroupsPostForbidden { + return &V1NetworkAddressGroupsPostForbidden{} +} + +/* +V1NetworkAddressGroupsPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkAddressGroupsPostForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups post forbidden response has a 2xx status code +func (o *V1NetworkAddressGroupsPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups post forbidden response has a 3xx status code +func (o *V1NetworkAddressGroupsPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups post forbidden response has a 4xx status code +func (o *V1NetworkAddressGroupsPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups post forbidden response has a 5xx status code +func (o *V1NetworkAddressGroupsPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups post forbidden response a status code equal to that given +func (o *V1NetworkAddressGroupsPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network address groups post forbidden response +func (o *V1NetworkAddressGroupsPostForbidden) Code() int { + return 403 +} + +func (o *V1NetworkAddressGroupsPostForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsPostForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsPostForbidden) 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 +} + +// NewV1NetworkAddressGroupsPostNotFound creates a V1NetworkAddressGroupsPostNotFound with default headers values +func NewV1NetworkAddressGroupsPostNotFound() *V1NetworkAddressGroupsPostNotFound { + return &V1NetworkAddressGroupsPostNotFound{} +} + +/* +V1NetworkAddressGroupsPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkAddressGroupsPostNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups post not found response has a 2xx status code +func (o *V1NetworkAddressGroupsPostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups post not found response has a 3xx status code +func (o *V1NetworkAddressGroupsPostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups post not found response has a 4xx status code +func (o *V1NetworkAddressGroupsPostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups post not found response has a 5xx status code +func (o *V1NetworkAddressGroupsPostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups post not found response a status code equal to that given +func (o *V1NetworkAddressGroupsPostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network address groups post not found response +func (o *V1NetworkAddressGroupsPostNotFound) Code() int { + return 404 +} + +func (o *V1NetworkAddressGroupsPostNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsPostNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsPostNotFound) 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 +} + +// NewV1NetworkAddressGroupsPostConflict creates a V1NetworkAddressGroupsPostConflict with default headers values +func NewV1NetworkAddressGroupsPostConflict() *V1NetworkAddressGroupsPostConflict { + return &V1NetworkAddressGroupsPostConflict{} +} + +/* +V1NetworkAddressGroupsPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkAddressGroupsPostConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups post conflict response has a 2xx status code +func (o *V1NetworkAddressGroupsPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups post conflict response has a 3xx status code +func (o *V1NetworkAddressGroupsPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups post conflict response has a 4xx status code +func (o *V1NetworkAddressGroupsPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups post conflict response has a 5xx status code +func (o *V1NetworkAddressGroupsPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups post conflict response a status code equal to that given +func (o *V1NetworkAddressGroupsPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network address groups post conflict response +func (o *V1NetworkAddressGroupsPostConflict) Code() int { + return 409 +} + +func (o *V1NetworkAddressGroupsPostConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostConflict %s", 409, payload) +} + +func (o *V1NetworkAddressGroupsPostConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostConflict %s", 409, payload) +} + +func (o *V1NetworkAddressGroupsPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsPostConflict) 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 +} + +// NewV1NetworkAddressGroupsPostUnprocessableEntity creates a V1NetworkAddressGroupsPostUnprocessableEntity with default headers values +func NewV1NetworkAddressGroupsPostUnprocessableEntity() *V1NetworkAddressGroupsPostUnprocessableEntity { + return &V1NetworkAddressGroupsPostUnprocessableEntity{} +} + +/* +V1NetworkAddressGroupsPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type V1NetworkAddressGroupsPostUnprocessableEntity struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups post unprocessable entity response has a 2xx status code +func (o *V1NetworkAddressGroupsPostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups post unprocessable entity response has a 3xx status code +func (o *V1NetworkAddressGroupsPostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups post unprocessable entity response has a 4xx status code +func (o *V1NetworkAddressGroupsPostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups post unprocessable entity response has a 5xx status code +func (o *V1NetworkAddressGroupsPostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups post unprocessable entity response a status code equal to that given +func (o *V1NetworkAddressGroupsPostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the v1 network address groups post unprocessable entity response +func (o *V1NetworkAddressGroupsPostUnprocessableEntity) Code() int { + return 422 +} + +func (o *V1NetworkAddressGroupsPostUnprocessableEntity) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworkAddressGroupsPostUnprocessableEntity) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworkAddressGroupsPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsPostUnprocessableEntity) 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 +} + +// NewV1NetworkAddressGroupsPostInternalServerError creates a V1NetworkAddressGroupsPostInternalServerError with default headers values +func NewV1NetworkAddressGroupsPostInternalServerError() *V1NetworkAddressGroupsPostInternalServerError { + return &V1NetworkAddressGroupsPostInternalServerError{} +} + +/* +V1NetworkAddressGroupsPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkAddressGroupsPostInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups post internal server error response has a 2xx status code +func (o *V1NetworkAddressGroupsPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups post internal server error response has a 3xx status code +func (o *V1NetworkAddressGroupsPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups post internal server error response has a 4xx status code +func (o *V1NetworkAddressGroupsPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups post internal server error response has a 5xx status code +func (o *V1NetworkAddressGroupsPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network address groups post internal server error response a status code equal to that given +func (o *V1NetworkAddressGroupsPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network address groups post internal server error response +func (o *V1NetworkAddressGroupsPostInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkAddressGroupsPostInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsPostInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsPostInternalServerError) 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/network_security_groups/network_security_groups_client.go b/power/client/network_security_groups/network_security_groups_client.go new file mode 100644 index 00000000..6822d35e --- /dev/null +++ b/power/client/network_security_groups/network_security_groups_client.go @@ -0,0 +1,477 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// 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 security groups API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new network security groups 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 security groups 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 security groups 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 { + V1NetworkSecurityGroupsActionPost(params *V1NetworkSecurityGroupsActionPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsActionPostOK, *V1NetworkSecurityGroupsActionPostAccepted, error) + + V1NetworkSecurityGroupsIDDelete(params *V1NetworkSecurityGroupsIDDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsIDDeleteOK, error) + + V1NetworkSecurityGroupsIDGet(params *V1NetworkSecurityGroupsIDGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsIDGetOK, error) + + V1NetworkSecurityGroupsIDPut(params *V1NetworkSecurityGroupsIDPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsIDPutOK, error) + + V1NetworkSecurityGroupsList(params *V1NetworkSecurityGroupsListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsListOK, error) + + V1NetworkSecurityGroupsMembersDelete(params *V1NetworkSecurityGroupsMembersDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsMembersDeleteOK, error) + + V1NetworkSecurityGroupsMembersPost(params *V1NetworkSecurityGroupsMembersPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsMembersPostOK, error) + + V1NetworkSecurityGroupsPost(params *V1NetworkSecurityGroupsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsPostOK, *V1NetworkSecurityGroupsPostCreated, error) + + V1NetworkSecurityGroupsRulesDelete(params *V1NetworkSecurityGroupsRulesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsRulesDeleteOK, error) + + V1NetworkSecurityGroupsRulesPost(params *V1NetworkSecurityGroupsRulesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsRulesPostOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +V1NetworkSecurityGroupsActionPost performs a network security groups action enable disable on a workspace on enablement a default network security group is created to allow all traffic for all active network iterfaces +*/ +func (a *Client) V1NetworkSecurityGroupsActionPost(params *V1NetworkSecurityGroupsActionPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsActionPostOK, *V1NetworkSecurityGroupsActionPostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkSecurityGroupsActionPostParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkSecurityGroups.action.post", + Method: "POST", + PathPattern: "/v1/network-security-groups/action", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkSecurityGroupsActionPostReader{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, nil, err + } + switch value := result.(type) { + case *V1NetworkSecurityGroupsActionPostOK: + return value, nil, nil + case *V1NetworkSecurityGroupsActionPostAccepted: + return nil, value, nil + } + // 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 network_security_groups: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkSecurityGroupsIDDelete deletes a network security group from a workspace +*/ +func (a *Client) V1NetworkSecurityGroupsIDDelete(params *V1NetworkSecurityGroupsIDDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsIDDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkSecurityGroupsIDDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkSecurityGroups.id.delete", + Method: "DELETE", + PathPattern: "/v1/network-security-groups/{network_security_group_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkSecurityGroupsIDDeleteReader{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.(*V1NetworkSecurityGroupsIDDeleteOK) + 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.networkSecurityGroups.id.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkSecurityGroupsIDGet gets the detail of a network security group +*/ +func (a *Client) V1NetworkSecurityGroupsIDGet(params *V1NetworkSecurityGroupsIDGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsIDGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkSecurityGroupsIDGetParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkSecurityGroups.id.get", + Method: "GET", + PathPattern: "/v1/network-security-groups/{network_security_group_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkSecurityGroupsIDGetReader{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.(*V1NetworkSecurityGroupsIDGetOK) + 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.networkSecurityGroups.id.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkSecurityGroupsIDPut updates a network security group +*/ +func (a *Client) V1NetworkSecurityGroupsIDPut(params *V1NetworkSecurityGroupsIDPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsIDPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkSecurityGroupsIDPutParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkSecurityGroups.id.put", + Method: "PUT", + PathPattern: "/v1/network-security-groups/{network_security_group_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkSecurityGroupsIDPutReader{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.(*V1NetworkSecurityGroupsIDPutOK) + 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.networkSecurityGroups.id.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkSecurityGroupsList gets the list of network security groups for a workspace +*/ +func (a *Client) V1NetworkSecurityGroupsList(params *V1NetworkSecurityGroupsListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsListOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkSecurityGroupsListParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkSecurityGroups.list", + Method: "GET", + PathPattern: "/v1/network-security-groups", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkSecurityGroupsListReader{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.(*V1NetworkSecurityGroupsListOK) + 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.networkSecurityGroups.list: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkSecurityGroupsMembersDelete deletes the member from a network security group +*/ +func (a *Client) V1NetworkSecurityGroupsMembersDelete(params *V1NetworkSecurityGroupsMembersDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsMembersDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkSecurityGroupsMembersDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkSecurityGroups.members.delete", + Method: "DELETE", + PathPattern: "/v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkSecurityGroupsMembersDeleteReader{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.(*V1NetworkSecurityGroupsMembersDeleteOK) + 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.networkSecurityGroups.members.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkSecurityGroupsMembersPost adds a member to a network security group +*/ +func (a *Client) V1NetworkSecurityGroupsMembersPost(params *V1NetworkSecurityGroupsMembersPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsMembersPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkSecurityGroupsMembersPostParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkSecurityGroups.members.post", + Method: "POST", + PathPattern: "/v1/network-security-groups/{network_security_group_id}/members", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkSecurityGroupsMembersPostReader{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.(*V1NetworkSecurityGroupsMembersPostOK) + 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.networkSecurityGroups.members.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkSecurityGroupsPost creates a new network security group +*/ +func (a *Client) V1NetworkSecurityGroupsPost(params *V1NetworkSecurityGroupsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsPostOK, *V1NetworkSecurityGroupsPostCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkSecurityGroupsPostParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkSecurityGroups.post", + Method: "POST", + PathPattern: "/v1/network-security-groups", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkSecurityGroupsPostReader{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, nil, err + } + switch value := result.(type) { + case *V1NetworkSecurityGroupsPostOK: + return value, nil, nil + case *V1NetworkSecurityGroupsPostCreated: + return nil, value, nil + } + // 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 network_security_groups: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkSecurityGroupsRulesDelete deletes the rule from a network security group +*/ +func (a *Client) V1NetworkSecurityGroupsRulesDelete(params *V1NetworkSecurityGroupsRulesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsRulesDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkSecurityGroupsRulesDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkSecurityGroups.rules.delete", + Method: "DELETE", + PathPattern: "/v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkSecurityGroupsRulesDeleteReader{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.(*V1NetworkSecurityGroupsRulesDeleteOK) + 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.networkSecurityGroups.rules.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkSecurityGroupsRulesPost adds a rule to a network security group +*/ +func (a *Client) V1NetworkSecurityGroupsRulesPost(params *V1NetworkSecurityGroupsRulesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsRulesPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkSecurityGroupsRulesPostParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkSecurityGroups.rules.post", + Method: "POST", + PathPattern: "/v1/network-security-groups/{network_security_group_id}/rules", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkSecurityGroupsRulesPostReader{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.(*V1NetworkSecurityGroupsRulesPostOK) + 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.networkSecurityGroups.rules.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/power/client/network_security_groups/v1_network_security_groups_action_post_parameters.go b/power/client/network_security_groups/v1_network_security_groups_action_post_parameters.go new file mode 100644 index 00000000..7481ad9c --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_action_post_parameters.go @@ -0,0 +1,153 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// 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" +) + +// NewV1NetworkSecurityGroupsActionPostParams creates a new V1NetworkSecurityGroupsActionPostParams 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 NewV1NetworkSecurityGroupsActionPostParams() *V1NetworkSecurityGroupsActionPostParams { + return &V1NetworkSecurityGroupsActionPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkSecurityGroupsActionPostParamsWithTimeout creates a new V1NetworkSecurityGroupsActionPostParams object +// with the ability to set a timeout on a request. +func NewV1NetworkSecurityGroupsActionPostParamsWithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsActionPostParams { + return &V1NetworkSecurityGroupsActionPostParams{ + timeout: timeout, + } +} + +// NewV1NetworkSecurityGroupsActionPostParamsWithContext creates a new V1NetworkSecurityGroupsActionPostParams object +// with the ability to set a context for a request. +func NewV1NetworkSecurityGroupsActionPostParamsWithContext(ctx context.Context) *V1NetworkSecurityGroupsActionPostParams { + return &V1NetworkSecurityGroupsActionPostParams{ + Context: ctx, + } +} + +// NewV1NetworkSecurityGroupsActionPostParamsWithHTTPClient creates a new V1NetworkSecurityGroupsActionPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkSecurityGroupsActionPostParamsWithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsActionPostParams { + return &V1NetworkSecurityGroupsActionPostParams{ + HTTPClient: client, + } +} + +/* +V1NetworkSecurityGroupsActionPostParams contains all the parameters to send to the API endpoint + + for the v1 network security groups action post operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkSecurityGroupsActionPostParams struct { + + /* Body. + + Parameters for the desired action + */ + Body *models.NetworkSecurityGroupsAction + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network security groups action post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsActionPostParams) WithDefaults() *V1NetworkSecurityGroupsActionPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network security groups action post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsActionPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network security groups action post params +func (o *V1NetworkSecurityGroupsActionPostParams) WithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsActionPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network security groups action post params +func (o *V1NetworkSecurityGroupsActionPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network security groups action post params +func (o *V1NetworkSecurityGroupsActionPostParams) WithContext(ctx context.Context) *V1NetworkSecurityGroupsActionPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network security groups action post params +func (o *V1NetworkSecurityGroupsActionPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network security groups action post params +func (o *V1NetworkSecurityGroupsActionPostParams) WithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsActionPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network security groups action post params +func (o *V1NetworkSecurityGroupsActionPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 network security groups action post params +func (o *V1NetworkSecurityGroupsActionPostParams) WithBody(body *models.NetworkSecurityGroupsAction) *V1NetworkSecurityGroupsActionPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 network security groups action post params +func (o *V1NetworkSecurityGroupsActionPostParams) SetBody(body *models.NetworkSecurityGroupsAction) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkSecurityGroupsActionPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_action_post_responses.go b/power/client/network_security_groups/v1_network_security_groups_action_post_responses.go new file mode 100644 index 00000000..2baaa04e --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_action_post_responses.go @@ -0,0 +1,634 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// 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" +) + +// V1NetworkSecurityGroupsActionPostReader is a Reader for the V1NetworkSecurityGroupsActionPost structure. +type V1NetworkSecurityGroupsActionPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkSecurityGroupsActionPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkSecurityGroupsActionPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 202: + result := NewV1NetworkSecurityGroupsActionPostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkSecurityGroupsActionPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkSecurityGroupsActionPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkSecurityGroupsActionPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkSecurityGroupsActionPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkSecurityGroupsActionPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkSecurityGroupsActionPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /v1/network-security-groups/action] v1.networkSecurityGroups.action.post", response, response.Code()) + } +} + +// NewV1NetworkSecurityGroupsActionPostOK creates a V1NetworkSecurityGroupsActionPostOK with default headers values +func NewV1NetworkSecurityGroupsActionPostOK() *V1NetworkSecurityGroupsActionPostOK { + return &V1NetworkSecurityGroupsActionPostOK{} +} + +/* +V1NetworkSecurityGroupsActionPostOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkSecurityGroupsActionPostOK struct { + Payload models.Object +} + +// IsSuccess returns true when this v1 network security groups action post o k response has a 2xx status code +func (o *V1NetworkSecurityGroupsActionPostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups action post o k response has a 3xx status code +func (o *V1NetworkSecurityGroupsActionPostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups action post o k response has a 4xx status code +func (o *V1NetworkSecurityGroupsActionPostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups action post o k response has a 5xx status code +func (o *V1NetworkSecurityGroupsActionPostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups action post o k response a status code equal to that given +func (o *V1NetworkSecurityGroupsActionPostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network security groups action post o k response +func (o *V1NetworkSecurityGroupsActionPostOK) Code() int { + return 200 +} + +func (o *V1NetworkSecurityGroupsActionPostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostOK) GetPayload() models.Object { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsActionPostOK) 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 +} + +// NewV1NetworkSecurityGroupsActionPostAccepted creates a V1NetworkSecurityGroupsActionPostAccepted with default headers values +func NewV1NetworkSecurityGroupsActionPostAccepted() *V1NetworkSecurityGroupsActionPostAccepted { + return &V1NetworkSecurityGroupsActionPostAccepted{} +} + +/* +V1NetworkSecurityGroupsActionPostAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type V1NetworkSecurityGroupsActionPostAccepted struct { + Payload models.Object +} + +// IsSuccess returns true when this v1 network security groups action post accepted response has a 2xx status code +func (o *V1NetworkSecurityGroupsActionPostAccepted) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups action post accepted response has a 3xx status code +func (o *V1NetworkSecurityGroupsActionPostAccepted) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups action post accepted response has a 4xx status code +func (o *V1NetworkSecurityGroupsActionPostAccepted) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups action post accepted response has a 5xx status code +func (o *V1NetworkSecurityGroupsActionPostAccepted) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups action post accepted response a status code equal to that given +func (o *V1NetworkSecurityGroupsActionPostAccepted) IsCode(code int) bool { + return code == 202 +} + +// Code gets the status code for the v1 network security groups action post accepted response +func (o *V1NetworkSecurityGroupsActionPostAccepted) Code() int { + return 202 +} + +func (o *V1NetworkSecurityGroupsActionPostAccepted) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostAccepted %s", 202, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostAccepted) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostAccepted %s", 202, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostAccepted) GetPayload() models.Object { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsActionPostAccepted) 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 +} + +// NewV1NetworkSecurityGroupsActionPostBadRequest creates a V1NetworkSecurityGroupsActionPostBadRequest with default headers values +func NewV1NetworkSecurityGroupsActionPostBadRequest() *V1NetworkSecurityGroupsActionPostBadRequest { + return &V1NetworkSecurityGroupsActionPostBadRequest{} +} + +/* +V1NetworkSecurityGroupsActionPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkSecurityGroupsActionPostBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups action post bad request response has a 2xx status code +func (o *V1NetworkSecurityGroupsActionPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups action post bad request response has a 3xx status code +func (o *V1NetworkSecurityGroupsActionPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups action post bad request response has a 4xx status code +func (o *V1NetworkSecurityGroupsActionPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups action post bad request response has a 5xx status code +func (o *V1NetworkSecurityGroupsActionPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups action post bad request response a status code equal to that given +func (o *V1NetworkSecurityGroupsActionPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network security groups action post bad request response +func (o *V1NetworkSecurityGroupsActionPostBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkSecurityGroupsActionPostBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsActionPostBadRequest) 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 +} + +// NewV1NetworkSecurityGroupsActionPostUnauthorized creates a V1NetworkSecurityGroupsActionPostUnauthorized with default headers values +func NewV1NetworkSecurityGroupsActionPostUnauthorized() *V1NetworkSecurityGroupsActionPostUnauthorized { + return &V1NetworkSecurityGroupsActionPostUnauthorized{} +} + +/* +V1NetworkSecurityGroupsActionPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkSecurityGroupsActionPostUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups action post unauthorized response has a 2xx status code +func (o *V1NetworkSecurityGroupsActionPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups action post unauthorized response has a 3xx status code +func (o *V1NetworkSecurityGroupsActionPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups action post unauthorized response has a 4xx status code +func (o *V1NetworkSecurityGroupsActionPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups action post unauthorized response has a 5xx status code +func (o *V1NetworkSecurityGroupsActionPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups action post unauthorized response a status code equal to that given +func (o *V1NetworkSecurityGroupsActionPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network security groups action post unauthorized response +func (o *V1NetworkSecurityGroupsActionPostUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkSecurityGroupsActionPostUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsActionPostUnauthorized) 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 +} + +// NewV1NetworkSecurityGroupsActionPostForbidden creates a V1NetworkSecurityGroupsActionPostForbidden with default headers values +func NewV1NetworkSecurityGroupsActionPostForbidden() *V1NetworkSecurityGroupsActionPostForbidden { + return &V1NetworkSecurityGroupsActionPostForbidden{} +} + +/* +V1NetworkSecurityGroupsActionPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkSecurityGroupsActionPostForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups action post forbidden response has a 2xx status code +func (o *V1NetworkSecurityGroupsActionPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups action post forbidden response has a 3xx status code +func (o *V1NetworkSecurityGroupsActionPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups action post forbidden response has a 4xx status code +func (o *V1NetworkSecurityGroupsActionPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups action post forbidden response has a 5xx status code +func (o *V1NetworkSecurityGroupsActionPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups action post forbidden response a status code equal to that given +func (o *V1NetworkSecurityGroupsActionPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network security groups action post forbidden response +func (o *V1NetworkSecurityGroupsActionPostForbidden) Code() int { + return 403 +} + +func (o *V1NetworkSecurityGroupsActionPostForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsActionPostForbidden) 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 +} + +// NewV1NetworkSecurityGroupsActionPostNotFound creates a V1NetworkSecurityGroupsActionPostNotFound with default headers values +func NewV1NetworkSecurityGroupsActionPostNotFound() *V1NetworkSecurityGroupsActionPostNotFound { + return &V1NetworkSecurityGroupsActionPostNotFound{} +} + +/* +V1NetworkSecurityGroupsActionPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkSecurityGroupsActionPostNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups action post not found response has a 2xx status code +func (o *V1NetworkSecurityGroupsActionPostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups action post not found response has a 3xx status code +func (o *V1NetworkSecurityGroupsActionPostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups action post not found response has a 4xx status code +func (o *V1NetworkSecurityGroupsActionPostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups action post not found response has a 5xx status code +func (o *V1NetworkSecurityGroupsActionPostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups action post not found response a status code equal to that given +func (o *V1NetworkSecurityGroupsActionPostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network security groups action post not found response +func (o *V1NetworkSecurityGroupsActionPostNotFound) Code() int { + return 404 +} + +func (o *V1NetworkSecurityGroupsActionPostNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsActionPostNotFound) 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 +} + +// NewV1NetworkSecurityGroupsActionPostConflict creates a V1NetworkSecurityGroupsActionPostConflict with default headers values +func NewV1NetworkSecurityGroupsActionPostConflict() *V1NetworkSecurityGroupsActionPostConflict { + return &V1NetworkSecurityGroupsActionPostConflict{} +} + +/* +V1NetworkSecurityGroupsActionPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkSecurityGroupsActionPostConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups action post conflict response has a 2xx status code +func (o *V1NetworkSecurityGroupsActionPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups action post conflict response has a 3xx status code +func (o *V1NetworkSecurityGroupsActionPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups action post conflict response has a 4xx status code +func (o *V1NetworkSecurityGroupsActionPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups action post conflict response has a 5xx status code +func (o *V1NetworkSecurityGroupsActionPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups action post conflict response a status code equal to that given +func (o *V1NetworkSecurityGroupsActionPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network security groups action post conflict response +func (o *V1NetworkSecurityGroupsActionPostConflict) Code() int { + return 409 +} + +func (o *V1NetworkSecurityGroupsActionPostConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsActionPostConflict) 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 +} + +// NewV1NetworkSecurityGroupsActionPostInternalServerError creates a V1NetworkSecurityGroupsActionPostInternalServerError with default headers values +func NewV1NetworkSecurityGroupsActionPostInternalServerError() *V1NetworkSecurityGroupsActionPostInternalServerError { + return &V1NetworkSecurityGroupsActionPostInternalServerError{} +} + +/* +V1NetworkSecurityGroupsActionPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkSecurityGroupsActionPostInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups action post internal server error response has a 2xx status code +func (o *V1NetworkSecurityGroupsActionPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups action post internal server error response has a 3xx status code +func (o *V1NetworkSecurityGroupsActionPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups action post internal server error response has a 4xx status code +func (o *V1NetworkSecurityGroupsActionPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups action post internal server error response has a 5xx status code +func (o *V1NetworkSecurityGroupsActionPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups action post internal server error response a status code equal to that given +func (o *V1NetworkSecurityGroupsActionPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network security groups action post internal server error response +func (o *V1NetworkSecurityGroupsActionPostInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkSecurityGroupsActionPostInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsActionPostInternalServerError) 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/network_security_groups/v1_network_security_groups_id_delete_parameters.go b/power/client/network_security_groups/v1_network_security_groups_id_delete_parameters.go new file mode 100644 index 00000000..b0f6b1f8 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_id_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// 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" +) + +// NewV1NetworkSecurityGroupsIDDeleteParams creates a new V1NetworkSecurityGroupsIDDeleteParams 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 NewV1NetworkSecurityGroupsIDDeleteParams() *V1NetworkSecurityGroupsIDDeleteParams { + return &V1NetworkSecurityGroupsIDDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkSecurityGroupsIDDeleteParamsWithTimeout creates a new V1NetworkSecurityGroupsIDDeleteParams object +// with the ability to set a timeout on a request. +func NewV1NetworkSecurityGroupsIDDeleteParamsWithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsIDDeleteParams { + return &V1NetworkSecurityGroupsIDDeleteParams{ + timeout: timeout, + } +} + +// NewV1NetworkSecurityGroupsIDDeleteParamsWithContext creates a new V1NetworkSecurityGroupsIDDeleteParams object +// with the ability to set a context for a request. +func NewV1NetworkSecurityGroupsIDDeleteParamsWithContext(ctx context.Context) *V1NetworkSecurityGroupsIDDeleteParams { + return &V1NetworkSecurityGroupsIDDeleteParams{ + Context: ctx, + } +} + +// NewV1NetworkSecurityGroupsIDDeleteParamsWithHTTPClient creates a new V1NetworkSecurityGroupsIDDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkSecurityGroupsIDDeleteParamsWithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsIDDeleteParams { + return &V1NetworkSecurityGroupsIDDeleteParams{ + HTTPClient: client, + } +} + +/* +V1NetworkSecurityGroupsIDDeleteParams contains all the parameters to send to the API endpoint + + for the v1 network security groups id delete operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkSecurityGroupsIDDeleteParams struct { + + /* NetworkSecurityGroupID. + + Network Security Group ID + */ + NetworkSecurityGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network security groups id delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsIDDeleteParams) WithDefaults() *V1NetworkSecurityGroupsIDDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network security groups id delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsIDDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network security groups id delete params +func (o *V1NetworkSecurityGroupsIDDeleteParams) WithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsIDDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network security groups id delete params +func (o *V1NetworkSecurityGroupsIDDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network security groups id delete params +func (o *V1NetworkSecurityGroupsIDDeleteParams) WithContext(ctx context.Context) *V1NetworkSecurityGroupsIDDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network security groups id delete params +func (o *V1NetworkSecurityGroupsIDDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network security groups id delete params +func (o *V1NetworkSecurityGroupsIDDeleteParams) WithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsIDDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network security groups id delete params +func (o *V1NetworkSecurityGroupsIDDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNetworkSecurityGroupID adds the networkSecurityGroupID to the v1 network security groups id delete params +func (o *V1NetworkSecurityGroupsIDDeleteParams) WithNetworkSecurityGroupID(networkSecurityGroupID string) *V1NetworkSecurityGroupsIDDeleteParams { + o.SetNetworkSecurityGroupID(networkSecurityGroupID) + return o +} + +// SetNetworkSecurityGroupID adds the networkSecurityGroupId to the v1 network security groups id delete params +func (o *V1NetworkSecurityGroupsIDDeleteParams) SetNetworkSecurityGroupID(networkSecurityGroupID string) { + o.NetworkSecurityGroupID = networkSecurityGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkSecurityGroupsIDDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param network_security_group_id + if err := r.SetPathParam("network_security_group_id", o.NetworkSecurityGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_id_delete_responses.go b/power/client/network_security_groups/v1_network_security_groups_id_delete_responses.go new file mode 100644 index 00000000..dcffcfb4 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_id_delete_responses.go @@ -0,0 +1,560 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// 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" +) + +// V1NetworkSecurityGroupsIDDeleteReader is a Reader for the V1NetworkSecurityGroupsIDDelete structure. +type V1NetworkSecurityGroupsIDDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkSecurityGroupsIDDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkSecurityGroupsIDDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkSecurityGroupsIDDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkSecurityGroupsIDDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkSecurityGroupsIDDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkSecurityGroupsIDDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkSecurityGroupsIDDeleteConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkSecurityGroupsIDDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /v1/network-security-groups/{network_security_group_id}] v1.networkSecurityGroups.id.delete", response, response.Code()) + } +} + +// NewV1NetworkSecurityGroupsIDDeleteOK creates a V1NetworkSecurityGroupsIDDeleteOK with default headers values +func NewV1NetworkSecurityGroupsIDDeleteOK() *V1NetworkSecurityGroupsIDDeleteOK { + return &V1NetworkSecurityGroupsIDDeleteOK{} +} + +/* +V1NetworkSecurityGroupsIDDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkSecurityGroupsIDDeleteOK struct { + Payload models.Object +} + +// IsSuccess returns true when this v1 network security groups Id delete o k response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups Id delete o k response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id delete o k response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups Id delete o k response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id delete o k response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network security groups Id delete o k response +func (o *V1NetworkSecurityGroupsIDDeleteOK) Code() int { + return 200 +} + +func (o *V1NetworkSecurityGroupsIDDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDDeleteOK) 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 +} + +// NewV1NetworkSecurityGroupsIDDeleteBadRequest creates a V1NetworkSecurityGroupsIDDeleteBadRequest with default headers values +func NewV1NetworkSecurityGroupsIDDeleteBadRequest() *V1NetworkSecurityGroupsIDDeleteBadRequest { + return &V1NetworkSecurityGroupsIDDeleteBadRequest{} +} + +/* +V1NetworkSecurityGroupsIDDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkSecurityGroupsIDDeleteBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id delete bad request response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id delete bad request response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id delete bad request response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id delete bad request response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id delete bad request response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network security groups Id delete bad request response +func (o *V1NetworkSecurityGroupsIDDeleteBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkSecurityGroupsIDDeleteBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDDeleteBadRequest) 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 +} + +// NewV1NetworkSecurityGroupsIDDeleteUnauthorized creates a V1NetworkSecurityGroupsIDDeleteUnauthorized with default headers values +func NewV1NetworkSecurityGroupsIDDeleteUnauthorized() *V1NetworkSecurityGroupsIDDeleteUnauthorized { + return &V1NetworkSecurityGroupsIDDeleteUnauthorized{} +} + +/* +V1NetworkSecurityGroupsIDDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkSecurityGroupsIDDeleteUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id delete unauthorized response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id delete unauthorized response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id delete unauthorized response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id delete unauthorized response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id delete unauthorized response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network security groups Id delete unauthorized response +func (o *V1NetworkSecurityGroupsIDDeleteUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkSecurityGroupsIDDeleteUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDDeleteUnauthorized) 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 +} + +// NewV1NetworkSecurityGroupsIDDeleteForbidden creates a V1NetworkSecurityGroupsIDDeleteForbidden with default headers values +func NewV1NetworkSecurityGroupsIDDeleteForbidden() *V1NetworkSecurityGroupsIDDeleteForbidden { + return &V1NetworkSecurityGroupsIDDeleteForbidden{} +} + +/* +V1NetworkSecurityGroupsIDDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkSecurityGroupsIDDeleteForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id delete forbidden response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id delete forbidden response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id delete forbidden response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id delete forbidden response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id delete forbidden response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network security groups Id delete forbidden response +func (o *V1NetworkSecurityGroupsIDDeleteForbidden) Code() int { + return 403 +} + +func (o *V1NetworkSecurityGroupsIDDeleteForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDDeleteForbidden) 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 +} + +// NewV1NetworkSecurityGroupsIDDeleteNotFound creates a V1NetworkSecurityGroupsIDDeleteNotFound with default headers values +func NewV1NetworkSecurityGroupsIDDeleteNotFound() *V1NetworkSecurityGroupsIDDeleteNotFound { + return &V1NetworkSecurityGroupsIDDeleteNotFound{} +} + +/* +V1NetworkSecurityGroupsIDDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkSecurityGroupsIDDeleteNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id delete not found response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id delete not found response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id delete not found response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id delete not found response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id delete not found response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network security groups Id delete not found response +func (o *V1NetworkSecurityGroupsIDDeleteNotFound) Code() int { + return 404 +} + +func (o *V1NetworkSecurityGroupsIDDeleteNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDDeleteNotFound) 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 +} + +// NewV1NetworkSecurityGroupsIDDeleteConflict creates a V1NetworkSecurityGroupsIDDeleteConflict with default headers values +func NewV1NetworkSecurityGroupsIDDeleteConflict() *V1NetworkSecurityGroupsIDDeleteConflict { + return &V1NetworkSecurityGroupsIDDeleteConflict{} +} + +/* +V1NetworkSecurityGroupsIDDeleteConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkSecurityGroupsIDDeleteConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id delete conflict response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDDeleteConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id delete conflict response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDDeleteConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id delete conflict response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDDeleteConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id delete conflict response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDDeleteConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id delete conflict response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDDeleteConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network security groups Id delete conflict response +func (o *V1NetworkSecurityGroupsIDDeleteConflict) Code() int { + return 409 +} + +func (o *V1NetworkSecurityGroupsIDDeleteConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDDeleteConflict) 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 +} + +// NewV1NetworkSecurityGroupsIDDeleteInternalServerError creates a V1NetworkSecurityGroupsIDDeleteInternalServerError with default headers values +func NewV1NetworkSecurityGroupsIDDeleteInternalServerError() *V1NetworkSecurityGroupsIDDeleteInternalServerError { + return &V1NetworkSecurityGroupsIDDeleteInternalServerError{} +} + +/* +V1NetworkSecurityGroupsIDDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkSecurityGroupsIDDeleteInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id delete internal server error response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id delete internal server error response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id delete internal server error response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups Id delete internal server error response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups Id delete internal server error response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network security groups Id delete internal server error response +func (o *V1NetworkSecurityGroupsIDDeleteInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkSecurityGroupsIDDeleteInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDDeleteInternalServerError) 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/network_security_groups/v1_network_security_groups_id_get_parameters.go b/power/client/network_security_groups/v1_network_security_groups_id_get_parameters.go new file mode 100644 index 00000000..fe003a1a --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_id_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// 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" +) + +// NewV1NetworkSecurityGroupsIDGetParams creates a new V1NetworkSecurityGroupsIDGetParams 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 NewV1NetworkSecurityGroupsIDGetParams() *V1NetworkSecurityGroupsIDGetParams { + return &V1NetworkSecurityGroupsIDGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkSecurityGroupsIDGetParamsWithTimeout creates a new V1NetworkSecurityGroupsIDGetParams object +// with the ability to set a timeout on a request. +func NewV1NetworkSecurityGroupsIDGetParamsWithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsIDGetParams { + return &V1NetworkSecurityGroupsIDGetParams{ + timeout: timeout, + } +} + +// NewV1NetworkSecurityGroupsIDGetParamsWithContext creates a new V1NetworkSecurityGroupsIDGetParams object +// with the ability to set a context for a request. +func NewV1NetworkSecurityGroupsIDGetParamsWithContext(ctx context.Context) *V1NetworkSecurityGroupsIDGetParams { + return &V1NetworkSecurityGroupsIDGetParams{ + Context: ctx, + } +} + +// NewV1NetworkSecurityGroupsIDGetParamsWithHTTPClient creates a new V1NetworkSecurityGroupsIDGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkSecurityGroupsIDGetParamsWithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsIDGetParams { + return &V1NetworkSecurityGroupsIDGetParams{ + HTTPClient: client, + } +} + +/* +V1NetworkSecurityGroupsIDGetParams contains all the parameters to send to the API endpoint + + for the v1 network security groups id get operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkSecurityGroupsIDGetParams struct { + + /* NetworkSecurityGroupID. + + Network Security Group ID + */ + NetworkSecurityGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network security groups id get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsIDGetParams) WithDefaults() *V1NetworkSecurityGroupsIDGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network security groups id get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsIDGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network security groups id get params +func (o *V1NetworkSecurityGroupsIDGetParams) WithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsIDGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network security groups id get params +func (o *V1NetworkSecurityGroupsIDGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network security groups id get params +func (o *V1NetworkSecurityGroupsIDGetParams) WithContext(ctx context.Context) *V1NetworkSecurityGroupsIDGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network security groups id get params +func (o *V1NetworkSecurityGroupsIDGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network security groups id get params +func (o *V1NetworkSecurityGroupsIDGetParams) WithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsIDGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network security groups id get params +func (o *V1NetworkSecurityGroupsIDGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNetworkSecurityGroupID adds the networkSecurityGroupID to the v1 network security groups id get params +func (o *V1NetworkSecurityGroupsIDGetParams) WithNetworkSecurityGroupID(networkSecurityGroupID string) *V1NetworkSecurityGroupsIDGetParams { + o.SetNetworkSecurityGroupID(networkSecurityGroupID) + return o +} + +// SetNetworkSecurityGroupID adds the networkSecurityGroupId to the v1 network security groups id get params +func (o *V1NetworkSecurityGroupsIDGetParams) SetNetworkSecurityGroupID(networkSecurityGroupID string) { + o.NetworkSecurityGroupID = networkSecurityGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkSecurityGroupsIDGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param network_security_group_id + if err := r.SetPathParam("network_security_group_id", o.NetworkSecurityGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_id_get_responses.go b/power/client/network_security_groups/v1_network_security_groups_id_get_responses.go new file mode 100644 index 00000000..9f2baad3 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_id_get_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// 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" +) + +// V1NetworkSecurityGroupsIDGetReader is a Reader for the V1NetworkSecurityGroupsIDGet structure. +type V1NetworkSecurityGroupsIDGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkSecurityGroupsIDGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkSecurityGroupsIDGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkSecurityGroupsIDGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkSecurityGroupsIDGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkSecurityGroupsIDGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkSecurityGroupsIDGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkSecurityGroupsIDGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/network-security-groups/{network_security_group_id}] v1.networkSecurityGroups.id.get", response, response.Code()) + } +} + +// NewV1NetworkSecurityGroupsIDGetOK creates a V1NetworkSecurityGroupsIDGetOK with default headers values +func NewV1NetworkSecurityGroupsIDGetOK() *V1NetworkSecurityGroupsIDGetOK { + return &V1NetworkSecurityGroupsIDGetOK{} +} + +/* +V1NetworkSecurityGroupsIDGetOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkSecurityGroupsIDGetOK struct { + Payload *models.NetworkSecurityGroup +} + +// IsSuccess returns true when this v1 network security groups Id get o k response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups Id get o k response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id get o k response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups Id get o k response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id get o k response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network security groups Id get o k response +func (o *V1NetworkSecurityGroupsIDGetOK) Code() int { + return 200 +} + +func (o *V1NetworkSecurityGroupsIDGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetOK) GetPayload() *models.NetworkSecurityGroup { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkSecurityGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsIDGetBadRequest creates a V1NetworkSecurityGroupsIDGetBadRequest with default headers values +func NewV1NetworkSecurityGroupsIDGetBadRequest() *V1NetworkSecurityGroupsIDGetBadRequest { + return &V1NetworkSecurityGroupsIDGetBadRequest{} +} + +/* +V1NetworkSecurityGroupsIDGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkSecurityGroupsIDGetBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id get bad request response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id get bad request response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id get bad request response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id get bad request response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id get bad request response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network security groups Id get bad request response +func (o *V1NetworkSecurityGroupsIDGetBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkSecurityGroupsIDGetBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDGetBadRequest) 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 +} + +// NewV1NetworkSecurityGroupsIDGetUnauthorized creates a V1NetworkSecurityGroupsIDGetUnauthorized with default headers values +func NewV1NetworkSecurityGroupsIDGetUnauthorized() *V1NetworkSecurityGroupsIDGetUnauthorized { + return &V1NetworkSecurityGroupsIDGetUnauthorized{} +} + +/* +V1NetworkSecurityGroupsIDGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkSecurityGroupsIDGetUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id get unauthorized response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id get unauthorized response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id get unauthorized response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id get unauthorized response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id get unauthorized response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network security groups Id get unauthorized response +func (o *V1NetworkSecurityGroupsIDGetUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkSecurityGroupsIDGetUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDGetUnauthorized) 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 +} + +// NewV1NetworkSecurityGroupsIDGetForbidden creates a V1NetworkSecurityGroupsIDGetForbidden with default headers values +func NewV1NetworkSecurityGroupsIDGetForbidden() *V1NetworkSecurityGroupsIDGetForbidden { + return &V1NetworkSecurityGroupsIDGetForbidden{} +} + +/* +V1NetworkSecurityGroupsIDGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkSecurityGroupsIDGetForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id get forbidden response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id get forbidden response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id get forbidden response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id get forbidden response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id get forbidden response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network security groups Id get forbidden response +func (o *V1NetworkSecurityGroupsIDGetForbidden) Code() int { + return 403 +} + +func (o *V1NetworkSecurityGroupsIDGetForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDGetForbidden) 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 +} + +// NewV1NetworkSecurityGroupsIDGetNotFound creates a V1NetworkSecurityGroupsIDGetNotFound with default headers values +func NewV1NetworkSecurityGroupsIDGetNotFound() *V1NetworkSecurityGroupsIDGetNotFound { + return &V1NetworkSecurityGroupsIDGetNotFound{} +} + +/* +V1NetworkSecurityGroupsIDGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkSecurityGroupsIDGetNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id get not found response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id get not found response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id get not found response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id get not found response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id get not found response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network security groups Id get not found response +func (o *V1NetworkSecurityGroupsIDGetNotFound) Code() int { + return 404 +} + +func (o *V1NetworkSecurityGroupsIDGetNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDGetNotFound) 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 +} + +// NewV1NetworkSecurityGroupsIDGetInternalServerError creates a V1NetworkSecurityGroupsIDGetInternalServerError with default headers values +func NewV1NetworkSecurityGroupsIDGetInternalServerError() *V1NetworkSecurityGroupsIDGetInternalServerError { + return &V1NetworkSecurityGroupsIDGetInternalServerError{} +} + +/* +V1NetworkSecurityGroupsIDGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkSecurityGroupsIDGetInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id get internal server error response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id get internal server error response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id get internal server error response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups Id get internal server error response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups Id get internal server error response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network security groups Id get internal server error response +func (o *V1NetworkSecurityGroupsIDGetInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkSecurityGroupsIDGetInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDGetInternalServerError) 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/network_security_groups/v1_network_security_groups_id_put_parameters.go b/power/client/network_security_groups/v1_network_security_groups_id_put_parameters.go new file mode 100644 index 00000000..be90c89b --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_id_put_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// 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" +) + +// NewV1NetworkSecurityGroupsIDPutParams creates a new V1NetworkSecurityGroupsIDPutParams 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 NewV1NetworkSecurityGroupsIDPutParams() *V1NetworkSecurityGroupsIDPutParams { + return &V1NetworkSecurityGroupsIDPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkSecurityGroupsIDPutParamsWithTimeout creates a new V1NetworkSecurityGroupsIDPutParams object +// with the ability to set a timeout on a request. +func NewV1NetworkSecurityGroupsIDPutParamsWithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsIDPutParams { + return &V1NetworkSecurityGroupsIDPutParams{ + timeout: timeout, + } +} + +// NewV1NetworkSecurityGroupsIDPutParamsWithContext creates a new V1NetworkSecurityGroupsIDPutParams object +// with the ability to set a context for a request. +func NewV1NetworkSecurityGroupsIDPutParamsWithContext(ctx context.Context) *V1NetworkSecurityGroupsIDPutParams { + return &V1NetworkSecurityGroupsIDPutParams{ + Context: ctx, + } +} + +// NewV1NetworkSecurityGroupsIDPutParamsWithHTTPClient creates a new V1NetworkSecurityGroupsIDPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkSecurityGroupsIDPutParamsWithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsIDPutParams { + return &V1NetworkSecurityGroupsIDPutParams{ + HTTPClient: client, + } +} + +/* +V1NetworkSecurityGroupsIDPutParams contains all the parameters to send to the API endpoint + + for the v1 network security groups id put operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkSecurityGroupsIDPutParams struct { + + /* Body. + + Parameters for the update of a Network Security Group + */ + Body *models.NetworkSecurityGroupUpdate + + /* NetworkSecurityGroupID. + + Network Security Group ID + */ + NetworkSecurityGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network security groups id put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsIDPutParams) WithDefaults() *V1NetworkSecurityGroupsIDPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network security groups id put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsIDPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network security groups id put params +func (o *V1NetworkSecurityGroupsIDPutParams) WithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsIDPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network security groups id put params +func (o *V1NetworkSecurityGroupsIDPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network security groups id put params +func (o *V1NetworkSecurityGroupsIDPutParams) WithContext(ctx context.Context) *V1NetworkSecurityGroupsIDPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network security groups id put params +func (o *V1NetworkSecurityGroupsIDPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network security groups id put params +func (o *V1NetworkSecurityGroupsIDPutParams) WithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsIDPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network security groups id put params +func (o *V1NetworkSecurityGroupsIDPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 network security groups id put params +func (o *V1NetworkSecurityGroupsIDPutParams) WithBody(body *models.NetworkSecurityGroupUpdate) *V1NetworkSecurityGroupsIDPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 network security groups id put params +func (o *V1NetworkSecurityGroupsIDPutParams) SetBody(body *models.NetworkSecurityGroupUpdate) { + o.Body = body +} + +// WithNetworkSecurityGroupID adds the networkSecurityGroupID to the v1 network security groups id put params +func (o *V1NetworkSecurityGroupsIDPutParams) WithNetworkSecurityGroupID(networkSecurityGroupID string) *V1NetworkSecurityGroupsIDPutParams { + o.SetNetworkSecurityGroupID(networkSecurityGroupID) + return o +} + +// SetNetworkSecurityGroupID adds the networkSecurityGroupId to the v1 network security groups id put params +func (o *V1NetworkSecurityGroupsIDPutParams) SetNetworkSecurityGroupID(networkSecurityGroupID string) { + o.NetworkSecurityGroupID = networkSecurityGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkSecurityGroupsIDPutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param network_security_group_id + if err := r.SetPathParam("network_security_group_id", o.NetworkSecurityGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_id_put_responses.go b/power/client/network_security_groups/v1_network_security_groups_id_put_responses.go new file mode 100644 index 00000000..2910a395 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_id_put_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// 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" +) + +// V1NetworkSecurityGroupsIDPutReader is a Reader for the V1NetworkSecurityGroupsIDPut structure. +type V1NetworkSecurityGroupsIDPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkSecurityGroupsIDPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkSecurityGroupsIDPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkSecurityGroupsIDPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkSecurityGroupsIDPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkSecurityGroupsIDPutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkSecurityGroupsIDPutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkSecurityGroupsIDPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /v1/network-security-groups/{network_security_group_id}] v1.networkSecurityGroups.id.put", response, response.Code()) + } +} + +// NewV1NetworkSecurityGroupsIDPutOK creates a V1NetworkSecurityGroupsIDPutOK with default headers values +func NewV1NetworkSecurityGroupsIDPutOK() *V1NetworkSecurityGroupsIDPutOK { + return &V1NetworkSecurityGroupsIDPutOK{} +} + +/* +V1NetworkSecurityGroupsIDPutOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkSecurityGroupsIDPutOK struct { + Payload *models.NetworkSecurityGroup +} + +// IsSuccess returns true when this v1 network security groups Id put o k response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDPutOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups Id put o k response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDPutOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id put o k response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDPutOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups Id put o k response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDPutOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id put o k response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDPutOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network security groups Id put o k response +func (o *V1NetworkSecurityGroupsIDPutOK) Code() int { + return 200 +} + +func (o *V1NetworkSecurityGroupsIDPutOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutOK) GetPayload() *models.NetworkSecurityGroup { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkSecurityGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsIDPutBadRequest creates a V1NetworkSecurityGroupsIDPutBadRequest with default headers values +func NewV1NetworkSecurityGroupsIDPutBadRequest() *V1NetworkSecurityGroupsIDPutBadRequest { + return &V1NetworkSecurityGroupsIDPutBadRequest{} +} + +/* +V1NetworkSecurityGroupsIDPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkSecurityGroupsIDPutBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id put bad request response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDPutBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id put bad request response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDPutBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id put bad request response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDPutBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id put bad request response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDPutBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id put bad request response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDPutBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network security groups Id put bad request response +func (o *V1NetworkSecurityGroupsIDPutBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkSecurityGroupsIDPutBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDPutBadRequest) 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 +} + +// NewV1NetworkSecurityGroupsIDPutUnauthorized creates a V1NetworkSecurityGroupsIDPutUnauthorized with default headers values +func NewV1NetworkSecurityGroupsIDPutUnauthorized() *V1NetworkSecurityGroupsIDPutUnauthorized { + return &V1NetworkSecurityGroupsIDPutUnauthorized{} +} + +/* +V1NetworkSecurityGroupsIDPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkSecurityGroupsIDPutUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id put unauthorized response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDPutUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id put unauthorized response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDPutUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id put unauthorized response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDPutUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id put unauthorized response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDPutUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id put unauthorized response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDPutUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network security groups Id put unauthorized response +func (o *V1NetworkSecurityGroupsIDPutUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkSecurityGroupsIDPutUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDPutUnauthorized) 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 +} + +// NewV1NetworkSecurityGroupsIDPutForbidden creates a V1NetworkSecurityGroupsIDPutForbidden with default headers values +func NewV1NetworkSecurityGroupsIDPutForbidden() *V1NetworkSecurityGroupsIDPutForbidden { + return &V1NetworkSecurityGroupsIDPutForbidden{} +} + +/* +V1NetworkSecurityGroupsIDPutForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkSecurityGroupsIDPutForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id put forbidden response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDPutForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id put forbidden response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDPutForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id put forbidden response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDPutForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id put forbidden response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDPutForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id put forbidden response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDPutForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network security groups Id put forbidden response +func (o *V1NetworkSecurityGroupsIDPutForbidden) Code() int { + return 403 +} + +func (o *V1NetworkSecurityGroupsIDPutForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDPutForbidden) 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 +} + +// NewV1NetworkSecurityGroupsIDPutNotFound creates a V1NetworkSecurityGroupsIDPutNotFound with default headers values +func NewV1NetworkSecurityGroupsIDPutNotFound() *V1NetworkSecurityGroupsIDPutNotFound { + return &V1NetworkSecurityGroupsIDPutNotFound{} +} + +/* +V1NetworkSecurityGroupsIDPutNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkSecurityGroupsIDPutNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id put not found response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDPutNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id put not found response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDPutNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id put not found response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDPutNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id put not found response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDPutNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id put not found response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDPutNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network security groups Id put not found response +func (o *V1NetworkSecurityGroupsIDPutNotFound) Code() int { + return 404 +} + +func (o *V1NetworkSecurityGroupsIDPutNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDPutNotFound) 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 +} + +// NewV1NetworkSecurityGroupsIDPutInternalServerError creates a V1NetworkSecurityGroupsIDPutInternalServerError with default headers values +func NewV1NetworkSecurityGroupsIDPutInternalServerError() *V1NetworkSecurityGroupsIDPutInternalServerError { + return &V1NetworkSecurityGroupsIDPutInternalServerError{} +} + +/* +V1NetworkSecurityGroupsIDPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkSecurityGroupsIDPutInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id put internal server error response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDPutInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id put internal server error response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDPutInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id put internal server error response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDPutInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups Id put internal server error response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDPutInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups Id put internal server error response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDPutInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network security groups Id put internal server error response +func (o *V1NetworkSecurityGroupsIDPutInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkSecurityGroupsIDPutInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDPutInternalServerError) 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/network_security_groups/v1_network_security_groups_list_parameters.go b/power/client/network_security_groups/v1_network_security_groups_list_parameters.go new file mode 100644 index 00000000..db9a44a7 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_list_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// 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" +) + +// NewV1NetworkSecurityGroupsListParams creates a new V1NetworkSecurityGroupsListParams 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 NewV1NetworkSecurityGroupsListParams() *V1NetworkSecurityGroupsListParams { + return &V1NetworkSecurityGroupsListParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkSecurityGroupsListParamsWithTimeout creates a new V1NetworkSecurityGroupsListParams object +// with the ability to set a timeout on a request. +func NewV1NetworkSecurityGroupsListParamsWithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsListParams { + return &V1NetworkSecurityGroupsListParams{ + timeout: timeout, + } +} + +// NewV1NetworkSecurityGroupsListParamsWithContext creates a new V1NetworkSecurityGroupsListParams object +// with the ability to set a context for a request. +func NewV1NetworkSecurityGroupsListParamsWithContext(ctx context.Context) *V1NetworkSecurityGroupsListParams { + return &V1NetworkSecurityGroupsListParams{ + Context: ctx, + } +} + +// NewV1NetworkSecurityGroupsListParamsWithHTTPClient creates a new V1NetworkSecurityGroupsListParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkSecurityGroupsListParamsWithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsListParams { + return &V1NetworkSecurityGroupsListParams{ + HTTPClient: client, + } +} + +/* +V1NetworkSecurityGroupsListParams contains all the parameters to send to the API endpoint + + for the v1 network security groups list operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkSecurityGroupsListParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network security groups list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsListParams) WithDefaults() *V1NetworkSecurityGroupsListParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network security groups list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsListParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network security groups list params +func (o *V1NetworkSecurityGroupsListParams) WithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsListParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network security groups list params +func (o *V1NetworkSecurityGroupsListParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network security groups list params +func (o *V1NetworkSecurityGroupsListParams) WithContext(ctx context.Context) *V1NetworkSecurityGroupsListParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network security groups list params +func (o *V1NetworkSecurityGroupsListParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network security groups list params +func (o *V1NetworkSecurityGroupsListParams) WithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsListParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network security groups list params +func (o *V1NetworkSecurityGroupsListParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkSecurityGroupsListParams) 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_security_groups/v1_network_security_groups_list_responses.go b/power/client/network_security_groups/v1_network_security_groups_list_responses.go new file mode 100644 index 00000000..4b71837d --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_list_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// 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" +) + +// V1NetworkSecurityGroupsListReader is a Reader for the V1NetworkSecurityGroupsList structure. +type V1NetworkSecurityGroupsListReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkSecurityGroupsListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkSecurityGroupsListOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkSecurityGroupsListBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkSecurityGroupsListUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkSecurityGroupsListForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkSecurityGroupsListNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkSecurityGroupsListInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/network-security-groups] v1.networkSecurityGroups.list", response, response.Code()) + } +} + +// NewV1NetworkSecurityGroupsListOK creates a V1NetworkSecurityGroupsListOK with default headers values +func NewV1NetworkSecurityGroupsListOK() *V1NetworkSecurityGroupsListOK { + return &V1NetworkSecurityGroupsListOK{} +} + +/* +V1NetworkSecurityGroupsListOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkSecurityGroupsListOK struct { + Payload *models.NetworkSecurityGroups +} + +// IsSuccess returns true when this v1 network security groups list o k response has a 2xx status code +func (o *V1NetworkSecurityGroupsListOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups list o k response has a 3xx status code +func (o *V1NetworkSecurityGroupsListOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups list o k response has a 4xx status code +func (o *V1NetworkSecurityGroupsListOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups list o k response has a 5xx status code +func (o *V1NetworkSecurityGroupsListOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups list o k response a status code equal to that given +func (o *V1NetworkSecurityGroupsListOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network security groups list o k response +func (o *V1NetworkSecurityGroupsListOK) Code() int { + return 200 +} + +func (o *V1NetworkSecurityGroupsListOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsListOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsListOK) GetPayload() *models.NetworkSecurityGroups { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsListOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkSecurityGroups) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsListBadRequest creates a V1NetworkSecurityGroupsListBadRequest with default headers values +func NewV1NetworkSecurityGroupsListBadRequest() *V1NetworkSecurityGroupsListBadRequest { + return &V1NetworkSecurityGroupsListBadRequest{} +} + +/* +V1NetworkSecurityGroupsListBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkSecurityGroupsListBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups list bad request response has a 2xx status code +func (o *V1NetworkSecurityGroupsListBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups list bad request response has a 3xx status code +func (o *V1NetworkSecurityGroupsListBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups list bad request response has a 4xx status code +func (o *V1NetworkSecurityGroupsListBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups list bad request response has a 5xx status code +func (o *V1NetworkSecurityGroupsListBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups list bad request response a status code equal to that given +func (o *V1NetworkSecurityGroupsListBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network security groups list bad request response +func (o *V1NetworkSecurityGroupsListBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkSecurityGroupsListBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsListBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsListBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsListBadRequest) 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 +} + +// NewV1NetworkSecurityGroupsListUnauthorized creates a V1NetworkSecurityGroupsListUnauthorized with default headers values +func NewV1NetworkSecurityGroupsListUnauthorized() *V1NetworkSecurityGroupsListUnauthorized { + return &V1NetworkSecurityGroupsListUnauthorized{} +} + +/* +V1NetworkSecurityGroupsListUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkSecurityGroupsListUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups list unauthorized response has a 2xx status code +func (o *V1NetworkSecurityGroupsListUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups list unauthorized response has a 3xx status code +func (o *V1NetworkSecurityGroupsListUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups list unauthorized response has a 4xx status code +func (o *V1NetworkSecurityGroupsListUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups list unauthorized response has a 5xx status code +func (o *V1NetworkSecurityGroupsListUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups list unauthorized response a status code equal to that given +func (o *V1NetworkSecurityGroupsListUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network security groups list unauthorized response +func (o *V1NetworkSecurityGroupsListUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkSecurityGroupsListUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsListUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsListUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsListUnauthorized) 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 +} + +// NewV1NetworkSecurityGroupsListForbidden creates a V1NetworkSecurityGroupsListForbidden with default headers values +func NewV1NetworkSecurityGroupsListForbidden() *V1NetworkSecurityGroupsListForbidden { + return &V1NetworkSecurityGroupsListForbidden{} +} + +/* +V1NetworkSecurityGroupsListForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkSecurityGroupsListForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups list forbidden response has a 2xx status code +func (o *V1NetworkSecurityGroupsListForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups list forbidden response has a 3xx status code +func (o *V1NetworkSecurityGroupsListForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups list forbidden response has a 4xx status code +func (o *V1NetworkSecurityGroupsListForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups list forbidden response has a 5xx status code +func (o *V1NetworkSecurityGroupsListForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups list forbidden response a status code equal to that given +func (o *V1NetworkSecurityGroupsListForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network security groups list forbidden response +func (o *V1NetworkSecurityGroupsListForbidden) Code() int { + return 403 +} + +func (o *V1NetworkSecurityGroupsListForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsListForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsListForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsListForbidden) 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 +} + +// NewV1NetworkSecurityGroupsListNotFound creates a V1NetworkSecurityGroupsListNotFound with default headers values +func NewV1NetworkSecurityGroupsListNotFound() *V1NetworkSecurityGroupsListNotFound { + return &V1NetworkSecurityGroupsListNotFound{} +} + +/* +V1NetworkSecurityGroupsListNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkSecurityGroupsListNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups list not found response has a 2xx status code +func (o *V1NetworkSecurityGroupsListNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups list not found response has a 3xx status code +func (o *V1NetworkSecurityGroupsListNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups list not found response has a 4xx status code +func (o *V1NetworkSecurityGroupsListNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups list not found response has a 5xx status code +func (o *V1NetworkSecurityGroupsListNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups list not found response a status code equal to that given +func (o *V1NetworkSecurityGroupsListNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network security groups list not found response +func (o *V1NetworkSecurityGroupsListNotFound) Code() int { + return 404 +} + +func (o *V1NetworkSecurityGroupsListNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsListNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsListNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsListNotFound) 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 +} + +// NewV1NetworkSecurityGroupsListInternalServerError creates a V1NetworkSecurityGroupsListInternalServerError with default headers values +func NewV1NetworkSecurityGroupsListInternalServerError() *V1NetworkSecurityGroupsListInternalServerError { + return &V1NetworkSecurityGroupsListInternalServerError{} +} + +/* +V1NetworkSecurityGroupsListInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkSecurityGroupsListInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups list internal server error response has a 2xx status code +func (o *V1NetworkSecurityGroupsListInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups list internal server error response has a 3xx status code +func (o *V1NetworkSecurityGroupsListInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups list internal server error response has a 4xx status code +func (o *V1NetworkSecurityGroupsListInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups list internal server error response has a 5xx status code +func (o *V1NetworkSecurityGroupsListInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups list internal server error response a status code equal to that given +func (o *V1NetworkSecurityGroupsListInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network security groups list internal server error response +func (o *V1NetworkSecurityGroupsListInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkSecurityGroupsListInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsListInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsListInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsListInternalServerError) 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/network_security_groups/v1_network_security_groups_members_delete_parameters.go b/power/client/network_security_groups/v1_network_security_groups_members_delete_parameters.go new file mode 100644 index 00000000..1fce6b31 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_members_delete_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// 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" +) + +// NewV1NetworkSecurityGroupsMembersDeleteParams creates a new V1NetworkSecurityGroupsMembersDeleteParams 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 NewV1NetworkSecurityGroupsMembersDeleteParams() *V1NetworkSecurityGroupsMembersDeleteParams { + return &V1NetworkSecurityGroupsMembersDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkSecurityGroupsMembersDeleteParamsWithTimeout creates a new V1NetworkSecurityGroupsMembersDeleteParams object +// with the ability to set a timeout on a request. +func NewV1NetworkSecurityGroupsMembersDeleteParamsWithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsMembersDeleteParams { + return &V1NetworkSecurityGroupsMembersDeleteParams{ + timeout: timeout, + } +} + +// NewV1NetworkSecurityGroupsMembersDeleteParamsWithContext creates a new V1NetworkSecurityGroupsMembersDeleteParams object +// with the ability to set a context for a request. +func NewV1NetworkSecurityGroupsMembersDeleteParamsWithContext(ctx context.Context) *V1NetworkSecurityGroupsMembersDeleteParams { + return &V1NetworkSecurityGroupsMembersDeleteParams{ + Context: ctx, + } +} + +// NewV1NetworkSecurityGroupsMembersDeleteParamsWithHTTPClient creates a new V1NetworkSecurityGroupsMembersDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkSecurityGroupsMembersDeleteParamsWithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsMembersDeleteParams { + return &V1NetworkSecurityGroupsMembersDeleteParams{ + HTTPClient: client, + } +} + +/* +V1NetworkSecurityGroupsMembersDeleteParams contains all the parameters to send to the API endpoint + + for the v1 network security groups members delete operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkSecurityGroupsMembersDeleteParams struct { + + /* NetworkSecurityGroupID. + + Network Security Group ID + */ + NetworkSecurityGroupID string + + /* NetworkSecurityGroupMemberID. + + Network Security Group Member ID + */ + NetworkSecurityGroupMemberID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network security groups members delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsMembersDeleteParams) WithDefaults() *V1NetworkSecurityGroupsMembersDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network security groups members delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsMembersDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network security groups members delete params +func (o *V1NetworkSecurityGroupsMembersDeleteParams) WithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsMembersDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network security groups members delete params +func (o *V1NetworkSecurityGroupsMembersDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network security groups members delete params +func (o *V1NetworkSecurityGroupsMembersDeleteParams) WithContext(ctx context.Context) *V1NetworkSecurityGroupsMembersDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network security groups members delete params +func (o *V1NetworkSecurityGroupsMembersDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network security groups members delete params +func (o *V1NetworkSecurityGroupsMembersDeleteParams) WithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsMembersDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network security groups members delete params +func (o *V1NetworkSecurityGroupsMembersDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNetworkSecurityGroupID adds the networkSecurityGroupID to the v1 network security groups members delete params +func (o *V1NetworkSecurityGroupsMembersDeleteParams) WithNetworkSecurityGroupID(networkSecurityGroupID string) *V1NetworkSecurityGroupsMembersDeleteParams { + o.SetNetworkSecurityGroupID(networkSecurityGroupID) + return o +} + +// SetNetworkSecurityGroupID adds the networkSecurityGroupId to the v1 network security groups members delete params +func (o *V1NetworkSecurityGroupsMembersDeleteParams) SetNetworkSecurityGroupID(networkSecurityGroupID string) { + o.NetworkSecurityGroupID = networkSecurityGroupID +} + +// WithNetworkSecurityGroupMemberID adds the networkSecurityGroupMemberID to the v1 network security groups members delete params +func (o *V1NetworkSecurityGroupsMembersDeleteParams) WithNetworkSecurityGroupMemberID(networkSecurityGroupMemberID string) *V1NetworkSecurityGroupsMembersDeleteParams { + o.SetNetworkSecurityGroupMemberID(networkSecurityGroupMemberID) + return o +} + +// SetNetworkSecurityGroupMemberID adds the networkSecurityGroupMemberId to the v1 network security groups members delete params +func (o *V1NetworkSecurityGroupsMembersDeleteParams) SetNetworkSecurityGroupMemberID(networkSecurityGroupMemberID string) { + o.NetworkSecurityGroupMemberID = networkSecurityGroupMemberID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkSecurityGroupsMembersDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param network_security_group_id + if err := r.SetPathParam("network_security_group_id", o.NetworkSecurityGroupID); err != nil { + return err + } + + // path param network_security_group_member_id + if err := r.SetPathParam("network_security_group_member_id", o.NetworkSecurityGroupMemberID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_members_delete_responses.go b/power/client/network_security_groups/v1_network_security_groups_members_delete_responses.go new file mode 100644 index 00000000..8d5336ab --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_members_delete_responses.go @@ -0,0 +1,562 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// 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" +) + +// V1NetworkSecurityGroupsMembersDeleteReader is a Reader for the V1NetworkSecurityGroupsMembersDelete structure. +type V1NetworkSecurityGroupsMembersDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkSecurityGroupsMembersDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkSecurityGroupsMembersDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkSecurityGroupsMembersDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkSecurityGroupsMembersDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkSecurityGroupsMembersDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkSecurityGroupsMembersDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkSecurityGroupsMembersDeleteConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkSecurityGroupsMembersDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}] v1.networkSecurityGroups.members.delete", response, response.Code()) + } +} + +// NewV1NetworkSecurityGroupsMembersDeleteOK creates a V1NetworkSecurityGroupsMembersDeleteOK with default headers values +func NewV1NetworkSecurityGroupsMembersDeleteOK() *V1NetworkSecurityGroupsMembersDeleteOK { + return &V1NetworkSecurityGroupsMembersDeleteOK{} +} + +/* +V1NetworkSecurityGroupsMembersDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkSecurityGroupsMembersDeleteOK struct { + Payload *models.NetworkSecurityGroup +} + +// IsSuccess returns true when this v1 network security groups members delete o k response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups members delete o k response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members delete o k response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups members delete o k response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members delete o k response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network security groups members delete o k response +func (o *V1NetworkSecurityGroupsMembersDeleteOK) Code() int { + return 200 +} + +func (o *V1NetworkSecurityGroupsMembersDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteOK) GetPayload() *models.NetworkSecurityGroup { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkSecurityGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsMembersDeleteBadRequest creates a V1NetworkSecurityGroupsMembersDeleteBadRequest with default headers values +func NewV1NetworkSecurityGroupsMembersDeleteBadRequest() *V1NetworkSecurityGroupsMembersDeleteBadRequest { + return &V1NetworkSecurityGroupsMembersDeleteBadRequest{} +} + +/* +V1NetworkSecurityGroupsMembersDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkSecurityGroupsMembersDeleteBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members delete bad request response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members delete bad request response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members delete bad request response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members delete bad request response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members delete bad request response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network security groups members delete bad request response +func (o *V1NetworkSecurityGroupsMembersDeleteBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkSecurityGroupsMembersDeleteBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersDeleteBadRequest) 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 +} + +// NewV1NetworkSecurityGroupsMembersDeleteUnauthorized creates a V1NetworkSecurityGroupsMembersDeleteUnauthorized with default headers values +func NewV1NetworkSecurityGroupsMembersDeleteUnauthorized() *V1NetworkSecurityGroupsMembersDeleteUnauthorized { + return &V1NetworkSecurityGroupsMembersDeleteUnauthorized{} +} + +/* +V1NetworkSecurityGroupsMembersDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkSecurityGroupsMembersDeleteUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members delete unauthorized response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members delete unauthorized response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members delete unauthorized response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members delete unauthorized response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members delete unauthorized response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network security groups members delete unauthorized response +func (o *V1NetworkSecurityGroupsMembersDeleteUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkSecurityGroupsMembersDeleteUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersDeleteUnauthorized) 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 +} + +// NewV1NetworkSecurityGroupsMembersDeleteForbidden creates a V1NetworkSecurityGroupsMembersDeleteForbidden with default headers values +func NewV1NetworkSecurityGroupsMembersDeleteForbidden() *V1NetworkSecurityGroupsMembersDeleteForbidden { + return &V1NetworkSecurityGroupsMembersDeleteForbidden{} +} + +/* +V1NetworkSecurityGroupsMembersDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkSecurityGroupsMembersDeleteForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members delete forbidden response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members delete forbidden response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members delete forbidden response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members delete forbidden response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members delete forbidden response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network security groups members delete forbidden response +func (o *V1NetworkSecurityGroupsMembersDeleteForbidden) Code() int { + return 403 +} + +func (o *V1NetworkSecurityGroupsMembersDeleteForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersDeleteForbidden) 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 +} + +// NewV1NetworkSecurityGroupsMembersDeleteNotFound creates a V1NetworkSecurityGroupsMembersDeleteNotFound with default headers values +func NewV1NetworkSecurityGroupsMembersDeleteNotFound() *V1NetworkSecurityGroupsMembersDeleteNotFound { + return &V1NetworkSecurityGroupsMembersDeleteNotFound{} +} + +/* +V1NetworkSecurityGroupsMembersDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkSecurityGroupsMembersDeleteNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members delete not found response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members delete not found response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members delete not found response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members delete not found response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members delete not found response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network security groups members delete not found response +func (o *V1NetworkSecurityGroupsMembersDeleteNotFound) Code() int { + return 404 +} + +func (o *V1NetworkSecurityGroupsMembersDeleteNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersDeleteNotFound) 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 +} + +// NewV1NetworkSecurityGroupsMembersDeleteConflict creates a V1NetworkSecurityGroupsMembersDeleteConflict with default headers values +func NewV1NetworkSecurityGroupsMembersDeleteConflict() *V1NetworkSecurityGroupsMembersDeleteConflict { + return &V1NetworkSecurityGroupsMembersDeleteConflict{} +} + +/* +V1NetworkSecurityGroupsMembersDeleteConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkSecurityGroupsMembersDeleteConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members delete conflict response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members delete conflict response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members delete conflict response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members delete conflict response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members delete conflict response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersDeleteConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network security groups members delete conflict response +func (o *V1NetworkSecurityGroupsMembersDeleteConflict) Code() int { + return 409 +} + +func (o *V1NetworkSecurityGroupsMembersDeleteConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersDeleteConflict) 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 +} + +// NewV1NetworkSecurityGroupsMembersDeleteInternalServerError creates a V1NetworkSecurityGroupsMembersDeleteInternalServerError with default headers values +func NewV1NetworkSecurityGroupsMembersDeleteInternalServerError() *V1NetworkSecurityGroupsMembersDeleteInternalServerError { + return &V1NetworkSecurityGroupsMembersDeleteInternalServerError{} +} + +/* +V1NetworkSecurityGroupsMembersDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkSecurityGroupsMembersDeleteInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members delete internal server error response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members delete internal server error response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members delete internal server error response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups members delete internal server error response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups members delete internal server error response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network security groups members delete internal server error response +func (o *V1NetworkSecurityGroupsMembersDeleteInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkSecurityGroupsMembersDeleteInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersDeleteInternalServerError) 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/network_security_groups/v1_network_security_groups_members_post_parameters.go b/power/client/network_security_groups/v1_network_security_groups_members_post_parameters.go new file mode 100644 index 00000000..52edfdc8 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_members_post_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// 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" +) + +// NewV1NetworkSecurityGroupsMembersPostParams creates a new V1NetworkSecurityGroupsMembersPostParams 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 NewV1NetworkSecurityGroupsMembersPostParams() *V1NetworkSecurityGroupsMembersPostParams { + return &V1NetworkSecurityGroupsMembersPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkSecurityGroupsMembersPostParamsWithTimeout creates a new V1NetworkSecurityGroupsMembersPostParams object +// with the ability to set a timeout on a request. +func NewV1NetworkSecurityGroupsMembersPostParamsWithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsMembersPostParams { + return &V1NetworkSecurityGroupsMembersPostParams{ + timeout: timeout, + } +} + +// NewV1NetworkSecurityGroupsMembersPostParamsWithContext creates a new V1NetworkSecurityGroupsMembersPostParams object +// with the ability to set a context for a request. +func NewV1NetworkSecurityGroupsMembersPostParamsWithContext(ctx context.Context) *V1NetworkSecurityGroupsMembersPostParams { + return &V1NetworkSecurityGroupsMembersPostParams{ + Context: ctx, + } +} + +// NewV1NetworkSecurityGroupsMembersPostParamsWithHTTPClient creates a new V1NetworkSecurityGroupsMembersPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkSecurityGroupsMembersPostParamsWithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsMembersPostParams { + return &V1NetworkSecurityGroupsMembersPostParams{ + HTTPClient: client, + } +} + +/* +V1NetworkSecurityGroupsMembersPostParams contains all the parameters to send to the API endpoint + + for the v1 network security groups members post operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkSecurityGroupsMembersPostParams struct { + + /* Body. + + Parameters for adding a member to a Network Security Group + */ + Body *models.NetworkSecurityGroupAddMember + + /* NetworkSecurityGroupID. + + Network Security Group ID + */ + NetworkSecurityGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network security groups members post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsMembersPostParams) WithDefaults() *V1NetworkSecurityGroupsMembersPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network security groups members post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsMembersPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network security groups members post params +func (o *V1NetworkSecurityGroupsMembersPostParams) WithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsMembersPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network security groups members post params +func (o *V1NetworkSecurityGroupsMembersPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network security groups members post params +func (o *V1NetworkSecurityGroupsMembersPostParams) WithContext(ctx context.Context) *V1NetworkSecurityGroupsMembersPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network security groups members post params +func (o *V1NetworkSecurityGroupsMembersPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network security groups members post params +func (o *V1NetworkSecurityGroupsMembersPostParams) WithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsMembersPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network security groups members post params +func (o *V1NetworkSecurityGroupsMembersPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 network security groups members post params +func (o *V1NetworkSecurityGroupsMembersPostParams) WithBody(body *models.NetworkSecurityGroupAddMember) *V1NetworkSecurityGroupsMembersPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 network security groups members post params +func (o *V1NetworkSecurityGroupsMembersPostParams) SetBody(body *models.NetworkSecurityGroupAddMember) { + o.Body = body +} + +// WithNetworkSecurityGroupID adds the networkSecurityGroupID to the v1 network security groups members post params +func (o *V1NetworkSecurityGroupsMembersPostParams) WithNetworkSecurityGroupID(networkSecurityGroupID string) *V1NetworkSecurityGroupsMembersPostParams { + o.SetNetworkSecurityGroupID(networkSecurityGroupID) + return o +} + +// SetNetworkSecurityGroupID adds the networkSecurityGroupId to the v1 network security groups members post params +func (o *V1NetworkSecurityGroupsMembersPostParams) SetNetworkSecurityGroupID(networkSecurityGroupID string) { + o.NetworkSecurityGroupID = networkSecurityGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkSecurityGroupsMembersPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param network_security_group_id + if err := r.SetPathParam("network_security_group_id", o.NetworkSecurityGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_members_post_responses.go b/power/client/network_security_groups/v1_network_security_groups_members_post_responses.go new file mode 100644 index 00000000..41faba80 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_members_post_responses.go @@ -0,0 +1,638 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// 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" +) + +// V1NetworkSecurityGroupsMembersPostReader is a Reader for the V1NetworkSecurityGroupsMembersPost structure. +type V1NetworkSecurityGroupsMembersPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkSecurityGroupsMembersPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkSecurityGroupsMembersPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkSecurityGroupsMembersPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkSecurityGroupsMembersPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkSecurityGroupsMembersPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkSecurityGroupsMembersPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkSecurityGroupsMembersPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewV1NetworkSecurityGroupsMembersPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkSecurityGroupsMembersPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /v1/network-security-groups/{network_security_group_id}/members] v1.networkSecurityGroups.members.post", response, response.Code()) + } +} + +// NewV1NetworkSecurityGroupsMembersPostOK creates a V1NetworkSecurityGroupsMembersPostOK with default headers values +func NewV1NetworkSecurityGroupsMembersPostOK() *V1NetworkSecurityGroupsMembersPostOK { + return &V1NetworkSecurityGroupsMembersPostOK{} +} + +/* +V1NetworkSecurityGroupsMembersPostOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkSecurityGroupsMembersPostOK struct { + Payload *models.NetworkSecurityGroup +} + +// IsSuccess returns true when this v1 network security groups members post o k response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersPostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups members post o k response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersPostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members post o k response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersPostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups members post o k response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersPostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members post o k response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersPostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network security groups members post o k response +func (o *V1NetworkSecurityGroupsMembersPostOK) Code() int { + return 200 +} + +func (o *V1NetworkSecurityGroupsMembersPostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostOK) GetPayload() *models.NetworkSecurityGroup { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkSecurityGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsMembersPostBadRequest creates a V1NetworkSecurityGroupsMembersPostBadRequest with default headers values +func NewV1NetworkSecurityGroupsMembersPostBadRequest() *V1NetworkSecurityGroupsMembersPostBadRequest { + return &V1NetworkSecurityGroupsMembersPostBadRequest{} +} + +/* +V1NetworkSecurityGroupsMembersPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkSecurityGroupsMembersPostBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members post bad request response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members post bad request response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members post bad request response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members post bad request response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members post bad request response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network security groups members post bad request response +func (o *V1NetworkSecurityGroupsMembersPostBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkSecurityGroupsMembersPostBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersPostBadRequest) 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 +} + +// NewV1NetworkSecurityGroupsMembersPostUnauthorized creates a V1NetworkSecurityGroupsMembersPostUnauthorized with default headers values +func NewV1NetworkSecurityGroupsMembersPostUnauthorized() *V1NetworkSecurityGroupsMembersPostUnauthorized { + return &V1NetworkSecurityGroupsMembersPostUnauthorized{} +} + +/* +V1NetworkSecurityGroupsMembersPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkSecurityGroupsMembersPostUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members post unauthorized response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members post unauthorized response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members post unauthorized response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members post unauthorized response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members post unauthorized response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network security groups members post unauthorized response +func (o *V1NetworkSecurityGroupsMembersPostUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkSecurityGroupsMembersPostUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersPostUnauthorized) 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 +} + +// NewV1NetworkSecurityGroupsMembersPostForbidden creates a V1NetworkSecurityGroupsMembersPostForbidden with default headers values +func NewV1NetworkSecurityGroupsMembersPostForbidden() *V1NetworkSecurityGroupsMembersPostForbidden { + return &V1NetworkSecurityGroupsMembersPostForbidden{} +} + +/* +V1NetworkSecurityGroupsMembersPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkSecurityGroupsMembersPostForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members post forbidden response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members post forbidden response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members post forbidden response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members post forbidden response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members post forbidden response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network security groups members post forbidden response +func (o *V1NetworkSecurityGroupsMembersPostForbidden) Code() int { + return 403 +} + +func (o *V1NetworkSecurityGroupsMembersPostForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersPostForbidden) 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 +} + +// NewV1NetworkSecurityGroupsMembersPostNotFound creates a V1NetworkSecurityGroupsMembersPostNotFound with default headers values +func NewV1NetworkSecurityGroupsMembersPostNotFound() *V1NetworkSecurityGroupsMembersPostNotFound { + return &V1NetworkSecurityGroupsMembersPostNotFound{} +} + +/* +V1NetworkSecurityGroupsMembersPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkSecurityGroupsMembersPostNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members post not found response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersPostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members post not found response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersPostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members post not found response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersPostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members post not found response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersPostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members post not found response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersPostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network security groups members post not found response +func (o *V1NetworkSecurityGroupsMembersPostNotFound) Code() int { + return 404 +} + +func (o *V1NetworkSecurityGroupsMembersPostNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersPostNotFound) 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 +} + +// NewV1NetworkSecurityGroupsMembersPostConflict creates a V1NetworkSecurityGroupsMembersPostConflict with default headers values +func NewV1NetworkSecurityGroupsMembersPostConflict() *V1NetworkSecurityGroupsMembersPostConflict { + return &V1NetworkSecurityGroupsMembersPostConflict{} +} + +/* +V1NetworkSecurityGroupsMembersPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkSecurityGroupsMembersPostConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members post conflict response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members post conflict response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members post conflict response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members post conflict response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members post conflict response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network security groups members post conflict response +func (o *V1NetworkSecurityGroupsMembersPostConflict) Code() int { + return 409 +} + +func (o *V1NetworkSecurityGroupsMembersPostConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersPostConflict) 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 +} + +// NewV1NetworkSecurityGroupsMembersPostUnprocessableEntity creates a V1NetworkSecurityGroupsMembersPostUnprocessableEntity with default headers values +func NewV1NetworkSecurityGroupsMembersPostUnprocessableEntity() *V1NetworkSecurityGroupsMembersPostUnprocessableEntity { + return &V1NetworkSecurityGroupsMembersPostUnprocessableEntity{} +} + +/* +V1NetworkSecurityGroupsMembersPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type V1NetworkSecurityGroupsMembersPostUnprocessableEntity struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members post unprocessable entity response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersPostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members post unprocessable entity response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersPostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members post unprocessable entity response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersPostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members post unprocessable entity response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersPostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members post unprocessable entity response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersPostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the v1 network security groups members post unprocessable entity response +func (o *V1NetworkSecurityGroupsMembersPostUnprocessableEntity) Code() int { + return 422 +} + +func (o *V1NetworkSecurityGroupsMembersPostUnprocessableEntity) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostUnprocessableEntity) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersPostUnprocessableEntity) 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 +} + +// NewV1NetworkSecurityGroupsMembersPostInternalServerError creates a V1NetworkSecurityGroupsMembersPostInternalServerError with default headers values +func NewV1NetworkSecurityGroupsMembersPostInternalServerError() *V1NetworkSecurityGroupsMembersPostInternalServerError { + return &V1NetworkSecurityGroupsMembersPostInternalServerError{} +} + +/* +V1NetworkSecurityGroupsMembersPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkSecurityGroupsMembersPostInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members post internal server error response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members post internal server error response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members post internal server error response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups members post internal server error response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups members post internal server error response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network security groups members post internal server error response +func (o *V1NetworkSecurityGroupsMembersPostInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkSecurityGroupsMembersPostInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersPostInternalServerError) 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/network_security_groups/v1_network_security_groups_post_parameters.go b/power/client/network_security_groups/v1_network_security_groups_post_parameters.go new file mode 100644 index 00000000..d827078a --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_post_parameters.go @@ -0,0 +1,153 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// 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" +) + +// NewV1NetworkSecurityGroupsPostParams creates a new V1NetworkSecurityGroupsPostParams 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 NewV1NetworkSecurityGroupsPostParams() *V1NetworkSecurityGroupsPostParams { + return &V1NetworkSecurityGroupsPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkSecurityGroupsPostParamsWithTimeout creates a new V1NetworkSecurityGroupsPostParams object +// with the ability to set a timeout on a request. +func NewV1NetworkSecurityGroupsPostParamsWithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsPostParams { + return &V1NetworkSecurityGroupsPostParams{ + timeout: timeout, + } +} + +// NewV1NetworkSecurityGroupsPostParamsWithContext creates a new V1NetworkSecurityGroupsPostParams object +// with the ability to set a context for a request. +func NewV1NetworkSecurityGroupsPostParamsWithContext(ctx context.Context) *V1NetworkSecurityGroupsPostParams { + return &V1NetworkSecurityGroupsPostParams{ + Context: ctx, + } +} + +// NewV1NetworkSecurityGroupsPostParamsWithHTTPClient creates a new V1NetworkSecurityGroupsPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkSecurityGroupsPostParamsWithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsPostParams { + return &V1NetworkSecurityGroupsPostParams{ + HTTPClient: client, + } +} + +/* +V1NetworkSecurityGroupsPostParams contains all the parameters to send to the API endpoint + + for the v1 network security groups post operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkSecurityGroupsPostParams struct { + + /* Body. + + Parameters for the creation of a Network Security Group + */ + Body *models.NetworkSecurityGroupCreate + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network security groups post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsPostParams) WithDefaults() *V1NetworkSecurityGroupsPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network security groups post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network security groups post params +func (o *V1NetworkSecurityGroupsPostParams) WithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network security groups post params +func (o *V1NetworkSecurityGroupsPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network security groups post params +func (o *V1NetworkSecurityGroupsPostParams) WithContext(ctx context.Context) *V1NetworkSecurityGroupsPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network security groups post params +func (o *V1NetworkSecurityGroupsPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network security groups post params +func (o *V1NetworkSecurityGroupsPostParams) WithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network security groups post params +func (o *V1NetworkSecurityGroupsPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 network security groups post params +func (o *V1NetworkSecurityGroupsPostParams) WithBody(body *models.NetworkSecurityGroupCreate) *V1NetworkSecurityGroupsPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 network security groups post params +func (o *V1NetworkSecurityGroupsPostParams) SetBody(body *models.NetworkSecurityGroupCreate) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkSecurityGroupsPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_post_responses.go b/power/client/network_security_groups/v1_network_security_groups_post_responses.go new file mode 100644 index 00000000..a384c457 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_post_responses.go @@ -0,0 +1,714 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// 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" +) + +// V1NetworkSecurityGroupsPostReader is a Reader for the V1NetworkSecurityGroupsPost structure. +type V1NetworkSecurityGroupsPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkSecurityGroupsPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkSecurityGroupsPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 201: + result := NewV1NetworkSecurityGroupsPostCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkSecurityGroupsPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkSecurityGroupsPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkSecurityGroupsPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkSecurityGroupsPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkSecurityGroupsPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewV1NetworkSecurityGroupsPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkSecurityGroupsPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /v1/network-security-groups] v1.networkSecurityGroups.post", response, response.Code()) + } +} + +// NewV1NetworkSecurityGroupsPostOK creates a V1NetworkSecurityGroupsPostOK with default headers values +func NewV1NetworkSecurityGroupsPostOK() *V1NetworkSecurityGroupsPostOK { + return &V1NetworkSecurityGroupsPostOK{} +} + +/* +V1NetworkSecurityGroupsPostOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkSecurityGroupsPostOK struct { + Payload *models.NetworkSecurityGroup +} + +// IsSuccess returns true when this v1 network security groups post o k response has a 2xx status code +func (o *V1NetworkSecurityGroupsPostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups post o k response has a 3xx status code +func (o *V1NetworkSecurityGroupsPostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups post o k response has a 4xx status code +func (o *V1NetworkSecurityGroupsPostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups post o k response has a 5xx status code +func (o *V1NetworkSecurityGroupsPostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups post o k response a status code equal to that given +func (o *V1NetworkSecurityGroupsPostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network security groups post o k response +func (o *V1NetworkSecurityGroupsPostOK) Code() int { + return 200 +} + +func (o *V1NetworkSecurityGroupsPostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsPostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsPostOK) GetPayload() *models.NetworkSecurityGroup { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkSecurityGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsPostCreated creates a V1NetworkSecurityGroupsPostCreated with default headers values +func NewV1NetworkSecurityGroupsPostCreated() *V1NetworkSecurityGroupsPostCreated { + return &V1NetworkSecurityGroupsPostCreated{} +} + +/* +V1NetworkSecurityGroupsPostCreated describes a response with status code 201, with default header values. + +Created +*/ +type V1NetworkSecurityGroupsPostCreated struct { + Payload *models.NetworkSecurityGroup +} + +// IsSuccess returns true when this v1 network security groups post created response has a 2xx status code +func (o *V1NetworkSecurityGroupsPostCreated) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups post created response has a 3xx status code +func (o *V1NetworkSecurityGroupsPostCreated) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups post created response has a 4xx status code +func (o *V1NetworkSecurityGroupsPostCreated) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups post created response has a 5xx status code +func (o *V1NetworkSecurityGroupsPostCreated) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups post created response a status code equal to that given +func (o *V1NetworkSecurityGroupsPostCreated) IsCode(code int) bool { + return code == 201 +} + +// Code gets the status code for the v1 network security groups post created response +func (o *V1NetworkSecurityGroupsPostCreated) Code() int { + return 201 +} + +func (o *V1NetworkSecurityGroupsPostCreated) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostCreated %s", 201, payload) +} + +func (o *V1NetworkSecurityGroupsPostCreated) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostCreated %s", 201, payload) +} + +func (o *V1NetworkSecurityGroupsPostCreated) GetPayload() *models.NetworkSecurityGroup { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkSecurityGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsPostBadRequest creates a V1NetworkSecurityGroupsPostBadRequest with default headers values +func NewV1NetworkSecurityGroupsPostBadRequest() *V1NetworkSecurityGroupsPostBadRequest { + return &V1NetworkSecurityGroupsPostBadRequest{} +} + +/* +V1NetworkSecurityGroupsPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkSecurityGroupsPostBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups post bad request response has a 2xx status code +func (o *V1NetworkSecurityGroupsPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups post bad request response has a 3xx status code +func (o *V1NetworkSecurityGroupsPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups post bad request response has a 4xx status code +func (o *V1NetworkSecurityGroupsPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups post bad request response has a 5xx status code +func (o *V1NetworkSecurityGroupsPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups post bad request response a status code equal to that given +func (o *V1NetworkSecurityGroupsPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network security groups post bad request response +func (o *V1NetworkSecurityGroupsPostBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkSecurityGroupsPostBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsPostBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsPostBadRequest) 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 +} + +// NewV1NetworkSecurityGroupsPostUnauthorized creates a V1NetworkSecurityGroupsPostUnauthorized with default headers values +func NewV1NetworkSecurityGroupsPostUnauthorized() *V1NetworkSecurityGroupsPostUnauthorized { + return &V1NetworkSecurityGroupsPostUnauthorized{} +} + +/* +V1NetworkSecurityGroupsPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkSecurityGroupsPostUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups post unauthorized response has a 2xx status code +func (o *V1NetworkSecurityGroupsPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups post unauthorized response has a 3xx status code +func (o *V1NetworkSecurityGroupsPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups post unauthorized response has a 4xx status code +func (o *V1NetworkSecurityGroupsPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups post unauthorized response has a 5xx status code +func (o *V1NetworkSecurityGroupsPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups post unauthorized response a status code equal to that given +func (o *V1NetworkSecurityGroupsPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network security groups post unauthorized response +func (o *V1NetworkSecurityGroupsPostUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkSecurityGroupsPostUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsPostUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsPostUnauthorized) 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 +} + +// NewV1NetworkSecurityGroupsPostForbidden creates a V1NetworkSecurityGroupsPostForbidden with default headers values +func NewV1NetworkSecurityGroupsPostForbidden() *V1NetworkSecurityGroupsPostForbidden { + return &V1NetworkSecurityGroupsPostForbidden{} +} + +/* +V1NetworkSecurityGroupsPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkSecurityGroupsPostForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups post forbidden response has a 2xx status code +func (o *V1NetworkSecurityGroupsPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups post forbidden response has a 3xx status code +func (o *V1NetworkSecurityGroupsPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups post forbidden response has a 4xx status code +func (o *V1NetworkSecurityGroupsPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups post forbidden response has a 5xx status code +func (o *V1NetworkSecurityGroupsPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups post forbidden response a status code equal to that given +func (o *V1NetworkSecurityGroupsPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network security groups post forbidden response +func (o *V1NetworkSecurityGroupsPostForbidden) Code() int { + return 403 +} + +func (o *V1NetworkSecurityGroupsPostForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsPostForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsPostForbidden) 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 +} + +// NewV1NetworkSecurityGroupsPostNotFound creates a V1NetworkSecurityGroupsPostNotFound with default headers values +func NewV1NetworkSecurityGroupsPostNotFound() *V1NetworkSecurityGroupsPostNotFound { + return &V1NetworkSecurityGroupsPostNotFound{} +} + +/* +V1NetworkSecurityGroupsPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkSecurityGroupsPostNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups post not found response has a 2xx status code +func (o *V1NetworkSecurityGroupsPostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups post not found response has a 3xx status code +func (o *V1NetworkSecurityGroupsPostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups post not found response has a 4xx status code +func (o *V1NetworkSecurityGroupsPostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups post not found response has a 5xx status code +func (o *V1NetworkSecurityGroupsPostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups post not found response a status code equal to that given +func (o *V1NetworkSecurityGroupsPostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network security groups post not found response +func (o *V1NetworkSecurityGroupsPostNotFound) Code() int { + return 404 +} + +func (o *V1NetworkSecurityGroupsPostNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsPostNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsPostNotFound) 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 +} + +// NewV1NetworkSecurityGroupsPostConflict creates a V1NetworkSecurityGroupsPostConflict with default headers values +func NewV1NetworkSecurityGroupsPostConflict() *V1NetworkSecurityGroupsPostConflict { + return &V1NetworkSecurityGroupsPostConflict{} +} + +/* +V1NetworkSecurityGroupsPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkSecurityGroupsPostConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups post conflict response has a 2xx status code +func (o *V1NetworkSecurityGroupsPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups post conflict response has a 3xx status code +func (o *V1NetworkSecurityGroupsPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups post conflict response has a 4xx status code +func (o *V1NetworkSecurityGroupsPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups post conflict response has a 5xx status code +func (o *V1NetworkSecurityGroupsPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups post conflict response a status code equal to that given +func (o *V1NetworkSecurityGroupsPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network security groups post conflict response +func (o *V1NetworkSecurityGroupsPostConflict) Code() int { + return 409 +} + +func (o *V1NetworkSecurityGroupsPostConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsPostConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsPostConflict) 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 +} + +// NewV1NetworkSecurityGroupsPostUnprocessableEntity creates a V1NetworkSecurityGroupsPostUnprocessableEntity with default headers values +func NewV1NetworkSecurityGroupsPostUnprocessableEntity() *V1NetworkSecurityGroupsPostUnprocessableEntity { + return &V1NetworkSecurityGroupsPostUnprocessableEntity{} +} + +/* +V1NetworkSecurityGroupsPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type V1NetworkSecurityGroupsPostUnprocessableEntity struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups post unprocessable entity response has a 2xx status code +func (o *V1NetworkSecurityGroupsPostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups post unprocessable entity response has a 3xx status code +func (o *V1NetworkSecurityGroupsPostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups post unprocessable entity response has a 4xx status code +func (o *V1NetworkSecurityGroupsPostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups post unprocessable entity response has a 5xx status code +func (o *V1NetworkSecurityGroupsPostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups post unprocessable entity response a status code equal to that given +func (o *V1NetworkSecurityGroupsPostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the v1 network security groups post unprocessable entity response +func (o *V1NetworkSecurityGroupsPostUnprocessableEntity) Code() int { + return 422 +} + +func (o *V1NetworkSecurityGroupsPostUnprocessableEntity) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworkSecurityGroupsPostUnprocessableEntity) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworkSecurityGroupsPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsPostUnprocessableEntity) 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 +} + +// NewV1NetworkSecurityGroupsPostInternalServerError creates a V1NetworkSecurityGroupsPostInternalServerError with default headers values +func NewV1NetworkSecurityGroupsPostInternalServerError() *V1NetworkSecurityGroupsPostInternalServerError { + return &V1NetworkSecurityGroupsPostInternalServerError{} +} + +/* +V1NetworkSecurityGroupsPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkSecurityGroupsPostInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups post internal server error response has a 2xx status code +func (o *V1NetworkSecurityGroupsPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups post internal server error response has a 3xx status code +func (o *V1NetworkSecurityGroupsPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups post internal server error response has a 4xx status code +func (o *V1NetworkSecurityGroupsPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups post internal server error response has a 5xx status code +func (o *V1NetworkSecurityGroupsPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups post internal server error response a status code equal to that given +func (o *V1NetworkSecurityGroupsPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network security groups post internal server error response +func (o *V1NetworkSecurityGroupsPostInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkSecurityGroupsPostInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsPostInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsPostInternalServerError) 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/network_security_groups/v1_network_security_groups_rules_delete_parameters.go b/power/client/network_security_groups/v1_network_security_groups_rules_delete_parameters.go new file mode 100644 index 00000000..c83eb86b --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_rules_delete_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// 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" +) + +// NewV1NetworkSecurityGroupsRulesDeleteParams creates a new V1NetworkSecurityGroupsRulesDeleteParams 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 NewV1NetworkSecurityGroupsRulesDeleteParams() *V1NetworkSecurityGroupsRulesDeleteParams { + return &V1NetworkSecurityGroupsRulesDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkSecurityGroupsRulesDeleteParamsWithTimeout creates a new V1NetworkSecurityGroupsRulesDeleteParams object +// with the ability to set a timeout on a request. +func NewV1NetworkSecurityGroupsRulesDeleteParamsWithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsRulesDeleteParams { + return &V1NetworkSecurityGroupsRulesDeleteParams{ + timeout: timeout, + } +} + +// NewV1NetworkSecurityGroupsRulesDeleteParamsWithContext creates a new V1NetworkSecurityGroupsRulesDeleteParams object +// with the ability to set a context for a request. +func NewV1NetworkSecurityGroupsRulesDeleteParamsWithContext(ctx context.Context) *V1NetworkSecurityGroupsRulesDeleteParams { + return &V1NetworkSecurityGroupsRulesDeleteParams{ + Context: ctx, + } +} + +// NewV1NetworkSecurityGroupsRulesDeleteParamsWithHTTPClient creates a new V1NetworkSecurityGroupsRulesDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkSecurityGroupsRulesDeleteParamsWithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsRulesDeleteParams { + return &V1NetworkSecurityGroupsRulesDeleteParams{ + HTTPClient: client, + } +} + +/* +V1NetworkSecurityGroupsRulesDeleteParams contains all the parameters to send to the API endpoint + + for the v1 network security groups rules delete operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkSecurityGroupsRulesDeleteParams struct { + + /* NetworkSecurityGroupID. + + Network Security Group ID + */ + NetworkSecurityGroupID string + + /* NetworkSecurityGroupRuleID. + + Network Security Group Rule ID + */ + NetworkSecurityGroupRuleID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network security groups rules delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsRulesDeleteParams) WithDefaults() *V1NetworkSecurityGroupsRulesDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network security groups rules delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsRulesDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network security groups rules delete params +func (o *V1NetworkSecurityGroupsRulesDeleteParams) WithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsRulesDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network security groups rules delete params +func (o *V1NetworkSecurityGroupsRulesDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network security groups rules delete params +func (o *V1NetworkSecurityGroupsRulesDeleteParams) WithContext(ctx context.Context) *V1NetworkSecurityGroupsRulesDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network security groups rules delete params +func (o *V1NetworkSecurityGroupsRulesDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network security groups rules delete params +func (o *V1NetworkSecurityGroupsRulesDeleteParams) WithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsRulesDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network security groups rules delete params +func (o *V1NetworkSecurityGroupsRulesDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNetworkSecurityGroupID adds the networkSecurityGroupID to the v1 network security groups rules delete params +func (o *V1NetworkSecurityGroupsRulesDeleteParams) WithNetworkSecurityGroupID(networkSecurityGroupID string) *V1NetworkSecurityGroupsRulesDeleteParams { + o.SetNetworkSecurityGroupID(networkSecurityGroupID) + return o +} + +// SetNetworkSecurityGroupID adds the networkSecurityGroupId to the v1 network security groups rules delete params +func (o *V1NetworkSecurityGroupsRulesDeleteParams) SetNetworkSecurityGroupID(networkSecurityGroupID string) { + o.NetworkSecurityGroupID = networkSecurityGroupID +} + +// WithNetworkSecurityGroupRuleID adds the networkSecurityGroupRuleID to the v1 network security groups rules delete params +func (o *V1NetworkSecurityGroupsRulesDeleteParams) WithNetworkSecurityGroupRuleID(networkSecurityGroupRuleID string) *V1NetworkSecurityGroupsRulesDeleteParams { + o.SetNetworkSecurityGroupRuleID(networkSecurityGroupRuleID) + return o +} + +// SetNetworkSecurityGroupRuleID adds the networkSecurityGroupRuleId to the v1 network security groups rules delete params +func (o *V1NetworkSecurityGroupsRulesDeleteParams) SetNetworkSecurityGroupRuleID(networkSecurityGroupRuleID string) { + o.NetworkSecurityGroupRuleID = networkSecurityGroupRuleID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkSecurityGroupsRulesDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param network_security_group_id + if err := r.SetPathParam("network_security_group_id", o.NetworkSecurityGroupID); err != nil { + return err + } + + // path param network_security_group_rule_id + if err := r.SetPathParam("network_security_group_rule_id", o.NetworkSecurityGroupRuleID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_rules_delete_responses.go b/power/client/network_security_groups/v1_network_security_groups_rules_delete_responses.go new file mode 100644 index 00000000..d7aec462 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_rules_delete_responses.go @@ -0,0 +1,562 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// 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" +) + +// V1NetworkSecurityGroupsRulesDeleteReader is a Reader for the V1NetworkSecurityGroupsRulesDelete structure. +type V1NetworkSecurityGroupsRulesDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkSecurityGroupsRulesDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkSecurityGroupsRulesDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkSecurityGroupsRulesDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkSecurityGroupsRulesDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkSecurityGroupsRulesDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkSecurityGroupsRulesDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkSecurityGroupsRulesDeleteConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkSecurityGroupsRulesDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}] v1.networkSecurityGroups.rules.delete", response, response.Code()) + } +} + +// NewV1NetworkSecurityGroupsRulesDeleteOK creates a V1NetworkSecurityGroupsRulesDeleteOK with default headers values +func NewV1NetworkSecurityGroupsRulesDeleteOK() *V1NetworkSecurityGroupsRulesDeleteOK { + return &V1NetworkSecurityGroupsRulesDeleteOK{} +} + +/* +V1NetworkSecurityGroupsRulesDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkSecurityGroupsRulesDeleteOK struct { + Payload *models.NetworkSecurityGroup +} + +// IsSuccess returns true when this v1 network security groups rules delete o k response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups rules delete o k response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules delete o k response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups rules delete o k response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules delete o k response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network security groups rules delete o k response +func (o *V1NetworkSecurityGroupsRulesDeleteOK) Code() int { + return 200 +} + +func (o *V1NetworkSecurityGroupsRulesDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteOK) GetPayload() *models.NetworkSecurityGroup { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkSecurityGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsRulesDeleteBadRequest creates a V1NetworkSecurityGroupsRulesDeleteBadRequest with default headers values +func NewV1NetworkSecurityGroupsRulesDeleteBadRequest() *V1NetworkSecurityGroupsRulesDeleteBadRequest { + return &V1NetworkSecurityGroupsRulesDeleteBadRequest{} +} + +/* +V1NetworkSecurityGroupsRulesDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkSecurityGroupsRulesDeleteBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules delete bad request response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules delete bad request response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules delete bad request response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules delete bad request response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules delete bad request response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network security groups rules delete bad request response +func (o *V1NetworkSecurityGroupsRulesDeleteBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkSecurityGroupsRulesDeleteBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesDeleteBadRequest) 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 +} + +// NewV1NetworkSecurityGroupsRulesDeleteUnauthorized creates a V1NetworkSecurityGroupsRulesDeleteUnauthorized with default headers values +func NewV1NetworkSecurityGroupsRulesDeleteUnauthorized() *V1NetworkSecurityGroupsRulesDeleteUnauthorized { + return &V1NetworkSecurityGroupsRulesDeleteUnauthorized{} +} + +/* +V1NetworkSecurityGroupsRulesDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkSecurityGroupsRulesDeleteUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules delete unauthorized response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules delete unauthorized response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules delete unauthorized response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules delete unauthorized response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules delete unauthorized response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network security groups rules delete unauthorized response +func (o *V1NetworkSecurityGroupsRulesDeleteUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkSecurityGroupsRulesDeleteUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesDeleteUnauthorized) 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 +} + +// NewV1NetworkSecurityGroupsRulesDeleteForbidden creates a V1NetworkSecurityGroupsRulesDeleteForbidden with default headers values +func NewV1NetworkSecurityGroupsRulesDeleteForbidden() *V1NetworkSecurityGroupsRulesDeleteForbidden { + return &V1NetworkSecurityGroupsRulesDeleteForbidden{} +} + +/* +V1NetworkSecurityGroupsRulesDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkSecurityGroupsRulesDeleteForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules delete forbidden response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules delete forbidden response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules delete forbidden response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules delete forbidden response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules delete forbidden response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network security groups rules delete forbidden response +func (o *V1NetworkSecurityGroupsRulesDeleteForbidden) Code() int { + return 403 +} + +func (o *V1NetworkSecurityGroupsRulesDeleteForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesDeleteForbidden) 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 +} + +// NewV1NetworkSecurityGroupsRulesDeleteNotFound creates a V1NetworkSecurityGroupsRulesDeleteNotFound with default headers values +func NewV1NetworkSecurityGroupsRulesDeleteNotFound() *V1NetworkSecurityGroupsRulesDeleteNotFound { + return &V1NetworkSecurityGroupsRulesDeleteNotFound{} +} + +/* +V1NetworkSecurityGroupsRulesDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkSecurityGroupsRulesDeleteNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules delete not found response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules delete not found response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules delete not found response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules delete not found response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules delete not found response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network security groups rules delete not found response +func (o *V1NetworkSecurityGroupsRulesDeleteNotFound) Code() int { + return 404 +} + +func (o *V1NetworkSecurityGroupsRulesDeleteNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesDeleteNotFound) 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 +} + +// NewV1NetworkSecurityGroupsRulesDeleteConflict creates a V1NetworkSecurityGroupsRulesDeleteConflict with default headers values +func NewV1NetworkSecurityGroupsRulesDeleteConflict() *V1NetworkSecurityGroupsRulesDeleteConflict { + return &V1NetworkSecurityGroupsRulesDeleteConflict{} +} + +/* +V1NetworkSecurityGroupsRulesDeleteConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkSecurityGroupsRulesDeleteConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules delete conflict response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules delete conflict response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules delete conflict response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules delete conflict response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules delete conflict response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesDeleteConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network security groups rules delete conflict response +func (o *V1NetworkSecurityGroupsRulesDeleteConflict) Code() int { + return 409 +} + +func (o *V1NetworkSecurityGroupsRulesDeleteConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesDeleteConflict) 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 +} + +// NewV1NetworkSecurityGroupsRulesDeleteInternalServerError creates a V1NetworkSecurityGroupsRulesDeleteInternalServerError with default headers values +func NewV1NetworkSecurityGroupsRulesDeleteInternalServerError() *V1NetworkSecurityGroupsRulesDeleteInternalServerError { + return &V1NetworkSecurityGroupsRulesDeleteInternalServerError{} +} + +/* +V1NetworkSecurityGroupsRulesDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkSecurityGroupsRulesDeleteInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules delete internal server error response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules delete internal server error response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules delete internal server error response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups rules delete internal server error response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups rules delete internal server error response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network security groups rules delete internal server error response +func (o *V1NetworkSecurityGroupsRulesDeleteInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkSecurityGroupsRulesDeleteInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesDeleteInternalServerError) 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/network_security_groups/v1_network_security_groups_rules_post_parameters.go b/power/client/network_security_groups/v1_network_security_groups_rules_post_parameters.go new file mode 100644 index 00000000..c5ba2923 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_rules_post_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// 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" +) + +// NewV1NetworkSecurityGroupsRulesPostParams creates a new V1NetworkSecurityGroupsRulesPostParams 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 NewV1NetworkSecurityGroupsRulesPostParams() *V1NetworkSecurityGroupsRulesPostParams { + return &V1NetworkSecurityGroupsRulesPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkSecurityGroupsRulesPostParamsWithTimeout creates a new V1NetworkSecurityGroupsRulesPostParams object +// with the ability to set a timeout on a request. +func NewV1NetworkSecurityGroupsRulesPostParamsWithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsRulesPostParams { + return &V1NetworkSecurityGroupsRulesPostParams{ + timeout: timeout, + } +} + +// NewV1NetworkSecurityGroupsRulesPostParamsWithContext creates a new V1NetworkSecurityGroupsRulesPostParams object +// with the ability to set a context for a request. +func NewV1NetworkSecurityGroupsRulesPostParamsWithContext(ctx context.Context) *V1NetworkSecurityGroupsRulesPostParams { + return &V1NetworkSecurityGroupsRulesPostParams{ + Context: ctx, + } +} + +// NewV1NetworkSecurityGroupsRulesPostParamsWithHTTPClient creates a new V1NetworkSecurityGroupsRulesPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkSecurityGroupsRulesPostParamsWithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsRulesPostParams { + return &V1NetworkSecurityGroupsRulesPostParams{ + HTTPClient: client, + } +} + +/* +V1NetworkSecurityGroupsRulesPostParams contains all the parameters to send to the API endpoint + + for the v1 network security groups rules post operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkSecurityGroupsRulesPostParams struct { + + /* Body. + + Parameters for adding a rule to a Network Security Group + */ + Body *models.NetworkSecurityGroupAddRule + + /* NetworkSecurityGroupID. + + Network Security Group ID + */ + NetworkSecurityGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network security groups rules post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsRulesPostParams) WithDefaults() *V1NetworkSecurityGroupsRulesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network security groups rules post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsRulesPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network security groups rules post params +func (o *V1NetworkSecurityGroupsRulesPostParams) WithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsRulesPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network security groups rules post params +func (o *V1NetworkSecurityGroupsRulesPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network security groups rules post params +func (o *V1NetworkSecurityGroupsRulesPostParams) WithContext(ctx context.Context) *V1NetworkSecurityGroupsRulesPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network security groups rules post params +func (o *V1NetworkSecurityGroupsRulesPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network security groups rules post params +func (o *V1NetworkSecurityGroupsRulesPostParams) WithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsRulesPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network security groups rules post params +func (o *V1NetworkSecurityGroupsRulesPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 network security groups rules post params +func (o *V1NetworkSecurityGroupsRulesPostParams) WithBody(body *models.NetworkSecurityGroupAddRule) *V1NetworkSecurityGroupsRulesPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 network security groups rules post params +func (o *V1NetworkSecurityGroupsRulesPostParams) SetBody(body *models.NetworkSecurityGroupAddRule) { + o.Body = body +} + +// WithNetworkSecurityGroupID adds the networkSecurityGroupID to the v1 network security groups rules post params +func (o *V1NetworkSecurityGroupsRulesPostParams) WithNetworkSecurityGroupID(networkSecurityGroupID string) *V1NetworkSecurityGroupsRulesPostParams { + o.SetNetworkSecurityGroupID(networkSecurityGroupID) + return o +} + +// SetNetworkSecurityGroupID adds the networkSecurityGroupId to the v1 network security groups rules post params +func (o *V1NetworkSecurityGroupsRulesPostParams) SetNetworkSecurityGroupID(networkSecurityGroupID string) { + o.NetworkSecurityGroupID = networkSecurityGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkSecurityGroupsRulesPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param network_security_group_id + if err := r.SetPathParam("network_security_group_id", o.NetworkSecurityGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_rules_post_responses.go b/power/client/network_security_groups/v1_network_security_groups_rules_post_responses.go new file mode 100644 index 00000000..27ae7369 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_rules_post_responses.go @@ -0,0 +1,638 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// 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" +) + +// V1NetworkSecurityGroupsRulesPostReader is a Reader for the V1NetworkSecurityGroupsRulesPost structure. +type V1NetworkSecurityGroupsRulesPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkSecurityGroupsRulesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkSecurityGroupsRulesPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkSecurityGroupsRulesPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkSecurityGroupsRulesPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkSecurityGroupsRulesPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkSecurityGroupsRulesPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkSecurityGroupsRulesPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewV1NetworkSecurityGroupsRulesPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkSecurityGroupsRulesPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /v1/network-security-groups/{network_security_group_id}/rules] v1.networkSecurityGroups.rules.post", response, response.Code()) + } +} + +// NewV1NetworkSecurityGroupsRulesPostOK creates a V1NetworkSecurityGroupsRulesPostOK with default headers values +func NewV1NetworkSecurityGroupsRulesPostOK() *V1NetworkSecurityGroupsRulesPostOK { + return &V1NetworkSecurityGroupsRulesPostOK{} +} + +/* +V1NetworkSecurityGroupsRulesPostOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkSecurityGroupsRulesPostOK struct { + Payload *models.NetworkSecurityGroup +} + +// IsSuccess returns true when this v1 network security groups rules post o k response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesPostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups rules post o k response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesPostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules post o k response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesPostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups rules post o k response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesPostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules post o k response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesPostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network security groups rules post o k response +func (o *V1NetworkSecurityGroupsRulesPostOK) Code() int { + return 200 +} + +func (o *V1NetworkSecurityGroupsRulesPostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostOK) GetPayload() *models.NetworkSecurityGroup { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkSecurityGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsRulesPostBadRequest creates a V1NetworkSecurityGroupsRulesPostBadRequest with default headers values +func NewV1NetworkSecurityGroupsRulesPostBadRequest() *V1NetworkSecurityGroupsRulesPostBadRequest { + return &V1NetworkSecurityGroupsRulesPostBadRequest{} +} + +/* +V1NetworkSecurityGroupsRulesPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkSecurityGroupsRulesPostBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules post bad request response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules post bad request response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules post bad request response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules post bad request response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules post bad request response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network security groups rules post bad request response +func (o *V1NetworkSecurityGroupsRulesPostBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkSecurityGroupsRulesPostBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesPostBadRequest) 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 +} + +// NewV1NetworkSecurityGroupsRulesPostUnauthorized creates a V1NetworkSecurityGroupsRulesPostUnauthorized with default headers values +func NewV1NetworkSecurityGroupsRulesPostUnauthorized() *V1NetworkSecurityGroupsRulesPostUnauthorized { + return &V1NetworkSecurityGroupsRulesPostUnauthorized{} +} + +/* +V1NetworkSecurityGroupsRulesPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkSecurityGroupsRulesPostUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules post unauthorized response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules post unauthorized response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules post unauthorized response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules post unauthorized response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules post unauthorized response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network security groups rules post unauthorized response +func (o *V1NetworkSecurityGroupsRulesPostUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkSecurityGroupsRulesPostUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesPostUnauthorized) 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 +} + +// NewV1NetworkSecurityGroupsRulesPostForbidden creates a V1NetworkSecurityGroupsRulesPostForbidden with default headers values +func NewV1NetworkSecurityGroupsRulesPostForbidden() *V1NetworkSecurityGroupsRulesPostForbidden { + return &V1NetworkSecurityGroupsRulesPostForbidden{} +} + +/* +V1NetworkSecurityGroupsRulesPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkSecurityGroupsRulesPostForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules post forbidden response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules post forbidden response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules post forbidden response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules post forbidden response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules post forbidden response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network security groups rules post forbidden response +func (o *V1NetworkSecurityGroupsRulesPostForbidden) Code() int { + return 403 +} + +func (o *V1NetworkSecurityGroupsRulesPostForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesPostForbidden) 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 +} + +// NewV1NetworkSecurityGroupsRulesPostNotFound creates a V1NetworkSecurityGroupsRulesPostNotFound with default headers values +func NewV1NetworkSecurityGroupsRulesPostNotFound() *V1NetworkSecurityGroupsRulesPostNotFound { + return &V1NetworkSecurityGroupsRulesPostNotFound{} +} + +/* +V1NetworkSecurityGroupsRulesPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkSecurityGroupsRulesPostNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules post not found response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesPostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules post not found response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesPostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules post not found response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesPostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules post not found response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesPostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules post not found response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesPostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network security groups rules post not found response +func (o *V1NetworkSecurityGroupsRulesPostNotFound) Code() int { + return 404 +} + +func (o *V1NetworkSecurityGroupsRulesPostNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesPostNotFound) 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 +} + +// NewV1NetworkSecurityGroupsRulesPostConflict creates a V1NetworkSecurityGroupsRulesPostConflict with default headers values +func NewV1NetworkSecurityGroupsRulesPostConflict() *V1NetworkSecurityGroupsRulesPostConflict { + return &V1NetworkSecurityGroupsRulesPostConflict{} +} + +/* +V1NetworkSecurityGroupsRulesPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkSecurityGroupsRulesPostConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules post conflict response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules post conflict response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules post conflict response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules post conflict response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules post conflict response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network security groups rules post conflict response +func (o *V1NetworkSecurityGroupsRulesPostConflict) Code() int { + return 409 +} + +func (o *V1NetworkSecurityGroupsRulesPostConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesPostConflict) 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 +} + +// NewV1NetworkSecurityGroupsRulesPostUnprocessableEntity creates a V1NetworkSecurityGroupsRulesPostUnprocessableEntity with default headers values +func NewV1NetworkSecurityGroupsRulesPostUnprocessableEntity() *V1NetworkSecurityGroupsRulesPostUnprocessableEntity { + return &V1NetworkSecurityGroupsRulesPostUnprocessableEntity{} +} + +/* +V1NetworkSecurityGroupsRulesPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type V1NetworkSecurityGroupsRulesPostUnprocessableEntity struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules post unprocessable entity response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesPostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules post unprocessable entity response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesPostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules post unprocessable entity response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesPostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules post unprocessable entity response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesPostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules post unprocessable entity response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesPostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the v1 network security groups rules post unprocessable entity response +func (o *V1NetworkSecurityGroupsRulesPostUnprocessableEntity) Code() int { + return 422 +} + +func (o *V1NetworkSecurityGroupsRulesPostUnprocessableEntity) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostUnprocessableEntity) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesPostUnprocessableEntity) 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 +} + +// NewV1NetworkSecurityGroupsRulesPostInternalServerError creates a V1NetworkSecurityGroupsRulesPostInternalServerError with default headers values +func NewV1NetworkSecurityGroupsRulesPostInternalServerError() *V1NetworkSecurityGroupsRulesPostInternalServerError { + return &V1NetworkSecurityGroupsRulesPostInternalServerError{} +} + +/* +V1NetworkSecurityGroupsRulesPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkSecurityGroupsRulesPostInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules post internal server error response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules post internal server error response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules post internal server error response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups rules post internal server error response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups rules post internal server error response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network security groups rules post internal server error response +func (o *V1NetworkSecurityGroupsRulesPostInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkSecurityGroupsRulesPostInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesPostInternalServerError) 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 3c14cb10..6a25d818 100644 --- a/power/client/power_iaas_api_client.go +++ b/power/client/power_iaas_api_client.go @@ -21,6 +21,8 @@ import ( "github.com/IBM-Cloud/power-go-client/power/client/internal_power_v_s_locations" "github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions" "github.com/IBM-Cloud/power-go-client/power/client/internal_transit_gateway" + "github.com/IBM-Cloud/power-go-client/power/client/network_address_groups" + "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" "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections" @@ -111,6 +113,8 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *PowerIaasA cli.InternalPowervsLocations = internal_power_v_s_locations.New(transport, formats) cli.InternalStorageRegions = internal_storage_regions.New(transport, formats) cli.InternalTransitGateway = internal_transit_gateway.New(transport, formats) + cli.NetworkAddressGroups = network_address_groups.New(transport, formats) + cli.NetworkSecurityGroups = network_security_groups.New(transport, formats) cli.Networks = networks.New(transport, formats) cli.OpenStacks = open_stacks.New(transport, formats) cli.PCloudCloudConnections = p_cloud_cloud_connections.New(transport, formats) @@ -212,6 +216,10 @@ type PowerIaasAPI struct { InternalTransitGateway internal_transit_gateway.ClientService + NetworkAddressGroups network_address_groups.ClientService + + NetworkSecurityGroups network_security_groups.ClientService + Networks networks.ClientService OpenStacks open_stacks.ClientService @@ -299,6 +307,8 @@ func (c *PowerIaasAPI) SetTransport(transport runtime.ClientTransport) { c.InternalPowervsLocations.SetTransport(transport) c.InternalStorageRegions.SetTransport(transport) c.InternalTransitGateway.SetTransport(transport) + c.NetworkAddressGroups.SetTransport(transport) + c.NetworkSecurityGroups.SetTransport(transport) c.Networks.SetTransport(transport) c.OpenStacks.SetTransport(transport) c.PCloudCloudConnections.SetTransport(transport) diff --git a/power/models/network_address_group.go b/power/models/network_address_group.go new file mode 100644 index 00000000..e14ebff5 --- /dev/null +++ b/power/models/network_address_group.go @@ -0,0 +1,176 @@ +// 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" +) + +// NetworkAddressGroup network address group +// +// swagger:model NetworkAddressGroup +type NetworkAddressGroup struct { + + // The Network Address Group's crn + // Required: true + Crn *string `json:"crn"` + + // The id of the Network Address Group + // Required: true + ID *string `json:"id"` + + // The list of IP addresses in CIDR notation (for example 192.168.66.2/32) in the Network Address Group + Members []*NetworkAddressGroupMember `json:"members"` + + // The name of the Network Address Group + // Required: true + Name *string `json:"name"` + + // The user tags associated with this resource. + UserTags []string `json:"userTags"` +} + +// Validate validates this network address group +func (m *NetworkAddressGroup) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMembers(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkAddressGroup) validateCrn(formats strfmt.Registry) error { + + if err := validate.Required("crn", "body", m.Crn); err != nil { + return err + } + + return nil +} + +func (m *NetworkAddressGroup) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *NetworkAddressGroup) validateMembers(formats strfmt.Registry) error { + if swag.IsZero(m.Members) { // not required + return nil + } + + for i := 0; i < len(m.Members); i++ { + if swag.IsZero(m.Members[i]) { // not required + continue + } + + if m.Members[i] != nil { + if err := m.Members[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("members" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("members" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *NetworkAddressGroup) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this network address group based on the context it is used +func (m *NetworkAddressGroup) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMembers(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkAddressGroup) contextValidateMembers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Members); i++ { + + if m.Members[i] != nil { + + if swag.IsZero(m.Members[i]) { // not required + return nil + } + + if err := m.Members[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("members" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("members" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkAddressGroup) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkAddressGroup) UnmarshalBinary(b []byte) error { + var res NetworkAddressGroup + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_address_group_add_member.go b/power/models/network_address_group_add_member.go new file mode 100644 index 00000000..8f12580c --- /dev/null +++ b/power/models/network_address_group_add_member.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" +) + +// NetworkAddressGroupAddMember network address group add member +// +// swagger:model NetworkAddressGroupAddMember +type NetworkAddressGroupAddMember struct { + + // The member to add in CIDR format + // Required: true + Cidr *string `json:"cidr"` +} + +// Validate validates this network address group add member +func (m *NetworkAddressGroupAddMember) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCidr(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkAddressGroupAddMember) validateCidr(formats strfmt.Registry) error { + + if err := validate.Required("cidr", "body", m.Cidr); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network address group add member based on context it is used +func (m *NetworkAddressGroupAddMember) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkAddressGroupAddMember) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkAddressGroupAddMember) UnmarshalBinary(b []byte) error { + var res NetworkAddressGroupAddMember + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_address_group_create.go b/power/models/network_address_group_create.go new file mode 100644 index 00000000..a41f1880 --- /dev/null +++ b/power/models/network_address_group_create.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" +) + +// NetworkAddressGroupCreate network address group create +// +// swagger:model NetworkAddressGroupCreate +type NetworkAddressGroupCreate struct { + + // The name of the Network Address Group + // Required: true + Name *string `json:"name"` + + // The user tags associated with this resource. + UserTags []string `json:"userTags"` +} + +// Validate validates this network address group create +func (m *NetworkAddressGroupCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkAddressGroupCreate) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network address group create based on context it is used +func (m *NetworkAddressGroupCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkAddressGroupCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkAddressGroupCreate) UnmarshalBinary(b []byte) error { + var res NetworkAddressGroupCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_address_group_member.go b/power/models/network_address_group_member.go new file mode 100644 index 00000000..8df76aaf --- /dev/null +++ b/power/models/network_address_group_member.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" +) + +// NetworkAddressGroupMember network address group member +// +// swagger:model NetworkAddressGroupMember +type NetworkAddressGroupMember struct { + + // The IP addresses in CIDR notation for example 192.168.1.5/32 + // Required: true + Cidr *string `json:"cidr"` + + // The id of the Network Address Group member IP addresses + // Required: true + ID *string `json:"id"` +} + +// Validate validates this network address group member +func (m *NetworkAddressGroupMember) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCidr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkAddressGroupMember) validateCidr(formats strfmt.Registry) error { + + if err := validate.Required("cidr", "body", m.Cidr); err != nil { + return err + } + + return nil +} + +func (m *NetworkAddressGroupMember) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network address group member based on context it is used +func (m *NetworkAddressGroupMember) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkAddressGroupMember) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkAddressGroupMember) UnmarshalBinary(b []byte) error { + var res NetworkAddressGroupMember + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_address_group_update.go b/power/models/network_address_group_update.go new file mode 100644 index 00000000..a6e4dca0 --- /dev/null +++ b/power/models/network_address_group_update.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" +) + +// NetworkAddressGroupUpdate network address group update +// +// swagger:model NetworkAddressGroupUpdate +type NetworkAddressGroupUpdate struct { + + // Replaces the current Network Address Group Name + Name string `json:"name,omitempty"` +} + +// Validate validates this network address group update +func (m *NetworkAddressGroupUpdate) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this network address group update based on context it is used +func (m *NetworkAddressGroupUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkAddressGroupUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkAddressGroupUpdate) UnmarshalBinary(b []byte) error { + var res NetworkAddressGroupUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_address_groups.go b/power/models/network_address_groups.go new file mode 100644 index 00000000..425077d8 --- /dev/null +++ b/power/models/network_address_groups.go @@ -0,0 +1,121 @@ +// 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" +) + +// NetworkAddressGroups network address groups +// +// swagger:model NetworkAddressGroups +type NetworkAddressGroups struct { + + // list of Network Address Groups + NetworkAddressGroups []*NetworkAddressGroup `json:"networkAddressGroups"` +} + +// Validate validates this network address groups +func (m *NetworkAddressGroups) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateNetworkAddressGroups(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkAddressGroups) validateNetworkAddressGroups(formats strfmt.Registry) error { + if swag.IsZero(m.NetworkAddressGroups) { // not required + return nil + } + + for i := 0; i < len(m.NetworkAddressGroups); i++ { + if swag.IsZero(m.NetworkAddressGroups[i]) { // not required + continue + } + + if m.NetworkAddressGroups[i] != nil { + if err := m.NetworkAddressGroups[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networkAddressGroups" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networkAddressGroups" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this network address groups based on the context it is used +func (m *NetworkAddressGroups) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateNetworkAddressGroups(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkAddressGroups) contextValidateNetworkAddressGroups(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.NetworkAddressGroups); i++ { + + if m.NetworkAddressGroups[i] != nil { + + if swag.IsZero(m.NetworkAddressGroups[i]) { // not required + return nil + } + + if err := m.NetworkAddressGroups[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networkAddressGroups" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networkAddressGroups" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkAddressGroups) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkAddressGroups) UnmarshalBinary(b []byte) error { + var res NetworkAddressGroups + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group.go b/power/models/network_security_group.go new file mode 100644 index 00000000..d62dc774 --- /dev/null +++ b/power/models/network_security_group.go @@ -0,0 +1,238 @@ +// 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" +) + +// NetworkSecurityGroup network security group +// +// swagger:model NetworkSecurityGroup +type NetworkSecurityGroup struct { + + // The Network Security Group's crn + // Required: true + Crn *string `json:"crn"` + + // The ID of the Network Security Group + // Required: true + ID *string `json:"id"` + + // The list of IPv4 addresses and\or Network Interfaces in the Network Security Group + Members []*NetworkSecurityGroupMember `json:"members"` + + // The name of the Network Security Group + // Required: true + Name *string `json:"name"` + + // The list of rules in the Network Security Group + Rules []*NetworkSecurityGroupRule `json:"rules"` + + // The user tags associated with this resource. + UserTags []string `json:"userTags"` +} + +// Validate validates this network security group +func (m *NetworkSecurityGroup) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMembers(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRules(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroup) validateCrn(formats strfmt.Registry) error { + + if err := validate.Required("crn", "body", m.Crn); err != nil { + return err + } + + return nil +} + +func (m *NetworkSecurityGroup) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *NetworkSecurityGroup) validateMembers(formats strfmt.Registry) error { + if swag.IsZero(m.Members) { // not required + return nil + } + + for i := 0; i < len(m.Members); i++ { + if swag.IsZero(m.Members[i]) { // not required + continue + } + + if m.Members[i] != nil { + if err := m.Members[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("members" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("members" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *NetworkSecurityGroup) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *NetworkSecurityGroup) validateRules(formats strfmt.Registry) error { + if swag.IsZero(m.Rules) { // not required + return nil + } + + for i := 0; i < len(m.Rules); i++ { + if swag.IsZero(m.Rules[i]) { // not required + continue + } + + if m.Rules[i] != nil { + if err := m.Rules[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rules" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this network security group based on the context it is used +func (m *NetworkSecurityGroup) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMembers(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRules(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroup) contextValidateMembers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Members); i++ { + + if m.Members[i] != nil { + + if swag.IsZero(m.Members[i]) { // not required + return nil + } + + if err := m.Members[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("members" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("members" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *NetworkSecurityGroup) contextValidateRules(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Rules); i++ { + + if m.Rules[i] != nil { + + if swag.IsZero(m.Rules[i]) { // not required + return nil + } + + if err := m.Rules[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rules" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroup) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroup) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroup + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group_add_member.go b/power/models/network_security_group_add_member.go new file mode 100644 index 00000000..abb75b1b --- /dev/null +++ b/power/models/network_security_group_add_member.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" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkSecurityGroupAddMember network security group add member +// +// swagger:model NetworkSecurityGroupAddMember +type NetworkSecurityGroupAddMember struct { + + // The target member to add. An IP4 address if ipv4-address type or a network interface ID if network-interface type + // Required: true + Target *string `json:"target"` + + // The type of member + // Required: true + // Enum: ["ipv4-address","network-interface"] + Type *string `json:"type"` +} + +// Validate validates this network security group add member +func (m *NetworkSecurityGroupAddMember) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTarget(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 *NetworkSecurityGroupAddMember) validateTarget(formats strfmt.Registry) error { + + if err := validate.Required("target", "body", m.Target); err != nil { + return err + } + + return nil +} + +var networkSecurityGroupAddMemberTypeTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["ipv4-address","network-interface"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkSecurityGroupAddMemberTypeTypePropEnum = append(networkSecurityGroupAddMemberTypeTypePropEnum, v) + } +} + +const ( + + // NetworkSecurityGroupAddMemberTypeIPV4DashAddress captures enum value "ipv4-address" + NetworkSecurityGroupAddMemberTypeIPV4DashAddress string = "ipv4-address" + + // NetworkSecurityGroupAddMemberTypeNetworkDashInterface captures enum value "network-interface" + NetworkSecurityGroupAddMemberTypeNetworkDashInterface string = "network-interface" +) + +// prop value enum +func (m *NetworkSecurityGroupAddMember) validateTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkSecurityGroupAddMemberTypeTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *NetworkSecurityGroupAddMember) validateType(formats strfmt.Registry) error { + + if err := validate.Required("type", "body", m.Type); err != nil { + return err + } + + // value enum + if err := m.validateTypeEnum("type", "body", *m.Type); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network security group add member based on context it is used +func (m *NetworkSecurityGroupAddMember) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupAddMember) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupAddMember) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupAddMember + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group_add_rule.go b/power/models/network_security_group_add_rule.go new file mode 100644 index 00000000..69b9bcd4 --- /dev/null +++ b/power/models/network_security_group_add_rule.go @@ -0,0 +1,381 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkSecurityGroupAddRule network security group add rule +// +// swagger:model NetworkSecurityGroupAddRule +type NetworkSecurityGroupAddRule struct { + + // The action to take if the rule matches network traffic + // Required: true + // Enum: ["allow","deny"] + Action *string `json:"action"` + + // destination ports + DestinationPorts *NetworkSecurityGroupRulePort `json:"destinationPorts,omitempty"` + + // The direction of the network traffic + // Required: true + // Enum: ["inbound","outbound"] + Direction *string `json:"direction"` + + // The unique name of the Network Security Group rule + // Required: true + Name *string `json:"name"` + + // protocol + // Required: true + Protocol *NetworkSecurityGroupRuleProtocol `json:"protocol"` + + // remote + // Required: true + Remote *NetworkSecurityGroupRuleRemote `json:"remote"` + + // source ports + SourcePorts *NetworkSecurityGroupRulePort `json:"sourcePorts,omitempty"` +} + +// Validate validates this network security group add rule +func (m *NetworkSecurityGroupAddRule) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAction(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDestinationPorts(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDirection(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProtocol(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRemote(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSourcePorts(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var networkSecurityGroupAddRuleTypeActionPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["allow","deny"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkSecurityGroupAddRuleTypeActionPropEnum = append(networkSecurityGroupAddRuleTypeActionPropEnum, v) + } +} + +const ( + + // NetworkSecurityGroupAddRuleActionAllow captures enum value "allow" + NetworkSecurityGroupAddRuleActionAllow string = "allow" + + // NetworkSecurityGroupAddRuleActionDeny captures enum value "deny" + NetworkSecurityGroupAddRuleActionDeny string = "deny" +) + +// prop value enum +func (m *NetworkSecurityGroupAddRule) validateActionEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkSecurityGroupAddRuleTypeActionPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *NetworkSecurityGroupAddRule) validateAction(formats strfmt.Registry) error { + + if err := validate.Required("action", "body", m.Action); err != nil { + return err + } + + // value enum + if err := m.validateActionEnum("action", "body", *m.Action); err != nil { + return err + } + + return nil +} + +func (m *NetworkSecurityGroupAddRule) validateDestinationPorts(formats strfmt.Registry) error { + if swag.IsZero(m.DestinationPorts) { // not required + return nil + } + + if m.DestinationPorts != nil { + if err := m.DestinationPorts.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("destinationPorts") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("destinationPorts") + } + return err + } + } + + return nil +} + +var networkSecurityGroupAddRuleTypeDirectionPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["inbound","outbound"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkSecurityGroupAddRuleTypeDirectionPropEnum = append(networkSecurityGroupAddRuleTypeDirectionPropEnum, v) + } +} + +const ( + + // NetworkSecurityGroupAddRuleDirectionInbound captures enum value "inbound" + NetworkSecurityGroupAddRuleDirectionInbound string = "inbound" + + // NetworkSecurityGroupAddRuleDirectionOutbound captures enum value "outbound" + NetworkSecurityGroupAddRuleDirectionOutbound string = "outbound" +) + +// prop value enum +func (m *NetworkSecurityGroupAddRule) validateDirectionEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkSecurityGroupAddRuleTypeDirectionPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *NetworkSecurityGroupAddRule) validateDirection(formats strfmt.Registry) error { + + if err := validate.Required("direction", "body", m.Direction); err != nil { + return err + } + + // value enum + if err := m.validateDirectionEnum("direction", "body", *m.Direction); err != nil { + return err + } + + return nil +} + +func (m *NetworkSecurityGroupAddRule) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *NetworkSecurityGroupAddRule) validateProtocol(formats strfmt.Registry) error { + + if err := validate.Required("protocol", "body", m.Protocol); err != nil { + return err + } + + if m.Protocol != nil { + if err := m.Protocol.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("protocol") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("protocol") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupAddRule) validateRemote(formats strfmt.Registry) error { + + if err := validate.Required("remote", "body", m.Remote); err != nil { + return err + } + + if m.Remote != nil { + if err := m.Remote.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("remote") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("remote") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupAddRule) validateSourcePorts(formats strfmt.Registry) error { + if swag.IsZero(m.SourcePorts) { // not required + return nil + } + + if m.SourcePorts != nil { + if err := m.SourcePorts.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sourcePorts") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sourcePorts") + } + return err + } + } + + return nil +} + +// ContextValidate validate this network security group add rule based on the context it is used +func (m *NetworkSecurityGroupAddRule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDestinationPorts(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateProtocol(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRemote(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSourcePorts(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroupAddRule) contextValidateDestinationPorts(ctx context.Context, formats strfmt.Registry) error { + + if m.DestinationPorts != nil { + + if swag.IsZero(m.DestinationPorts) { // not required + return nil + } + + if err := m.DestinationPorts.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("destinationPorts") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("destinationPorts") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupAddRule) contextValidateProtocol(ctx context.Context, formats strfmt.Registry) error { + + if m.Protocol != nil { + + if err := m.Protocol.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("protocol") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("protocol") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupAddRule) contextValidateRemote(ctx context.Context, formats strfmt.Registry) error { + + if m.Remote != nil { + + if err := m.Remote.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("remote") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("remote") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupAddRule) contextValidateSourcePorts(ctx context.Context, formats strfmt.Registry) error { + + if m.SourcePorts != nil { + + if swag.IsZero(m.SourcePorts) { // not required + return nil + } + + if err := m.SourcePorts.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sourcePorts") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sourcePorts") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupAddRule) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupAddRule) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupAddRule + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group_create.go b/power/models/network_security_group_create.go new file mode 100644 index 00000000..fc0bd27e --- /dev/null +++ b/power/models/network_security_group_create.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" +) + +// NetworkSecurityGroupCreate network security group create +// +// swagger:model NetworkSecurityGroupCreate +type NetworkSecurityGroupCreate struct { + + // The name of the Network Security Group + // Required: true + Name *string `json:"name"` + + // The user tags associated with this resource. + UserTags []string `json:"userTags"` +} + +// Validate validates this network security group create +func (m *NetworkSecurityGroupCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroupCreate) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network security group create based on context it is used +func (m *NetworkSecurityGroupCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupCreate) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group_member.go b/power/models/network_security_group_member.go new file mode 100644 index 00000000..533ffe59 --- /dev/null +++ b/power/models/network_security_group_member.go @@ -0,0 +1,144 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkSecurityGroupMember network security group member +// +// swagger:model NetworkSecurityGroupMember +type NetworkSecurityGroupMember struct { + + // The ID of the member in a Network Security Group + // Required: true + ID *string `json:"id"` + + // The mac address of a Network Interface included if the type is network-interface + MacAddress string `json:"macAddress,omitempty"` + + // If ipv4-address type, then IPv4 address or if network-interface type, then network interface ID + // Required: true + Target *string `json:"target"` + + // The type of member + // Required: true + // Enum: ["ipv4-address","network-interface"] + Type *string `json:"type"` +} + +// Validate validates this network security group member +func (m *NetworkSecurityGroupMember) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTarget(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 *NetworkSecurityGroupMember) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *NetworkSecurityGroupMember) validateTarget(formats strfmt.Registry) error { + + if err := validate.Required("target", "body", m.Target); err != nil { + return err + } + + return nil +} + +var networkSecurityGroupMemberTypeTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["ipv4-address","network-interface"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkSecurityGroupMemberTypeTypePropEnum = append(networkSecurityGroupMemberTypeTypePropEnum, v) + } +} + +const ( + + // NetworkSecurityGroupMemberTypeIPV4DashAddress captures enum value "ipv4-address" + NetworkSecurityGroupMemberTypeIPV4DashAddress string = "ipv4-address" + + // NetworkSecurityGroupMemberTypeNetworkDashInterface captures enum value "network-interface" + NetworkSecurityGroupMemberTypeNetworkDashInterface string = "network-interface" +) + +// prop value enum +func (m *NetworkSecurityGroupMember) validateTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkSecurityGroupMemberTypeTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *NetworkSecurityGroupMember) validateType(formats strfmt.Registry) error { + + if err := validate.Required("type", "body", m.Type); err != nil { + return err + } + + // value enum + if err := m.validateTypeEnum("type", "body", *m.Type); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network security group member based on context it is used +func (m *NetworkSecurityGroupMember) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupMember) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupMember) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupMember + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group_rule.go b/power/models/network_security_group_rule.go new file mode 100644 index 00000000..00c26042 --- /dev/null +++ b/power/models/network_security_group_rule.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkSecurityGroupRule network security group rule +// +// swagger:model NetworkSecurityGroupRule +type NetworkSecurityGroupRule struct { + + // The action to take if the rule matches network traffic + // Required: true + // Enum: ["allow","deny"] + Action *string `json:"action"` + + // destination port + DestinationPort *NetworkSecurityGroupRulePort `json:"destinationPort,omitempty"` + + // The direction of the network traffic + // Required: true + // Enum: ["inbound","outbound"] + Direction *string `json:"direction"` + + // The ID of the rule in a Network Security Group + // Required: true + ID *string `json:"id"` + + // The unique name of the Network Security Group rule + // Required: true + Name *string `json:"name"` + + // protocol + // Required: true + Protocol *NetworkSecurityGroupRuleProtocol `json:"protocol"` + + // remote + // Required: true + Remote *NetworkSecurityGroupRuleRemote `json:"remote"` + + // source port + SourcePort *NetworkSecurityGroupRulePort `json:"sourcePort,omitempty"` +} + +// Validate validates this network security group rule +func (m *NetworkSecurityGroupRule) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAction(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDestinationPort(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDirection(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.validateProtocol(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRemote(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSourcePort(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var networkSecurityGroupRuleTypeActionPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["allow","deny"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkSecurityGroupRuleTypeActionPropEnum = append(networkSecurityGroupRuleTypeActionPropEnum, v) + } +} + +const ( + + // NetworkSecurityGroupRuleActionAllow captures enum value "allow" + NetworkSecurityGroupRuleActionAllow string = "allow" + + // NetworkSecurityGroupRuleActionDeny captures enum value "deny" + NetworkSecurityGroupRuleActionDeny string = "deny" +) + +// prop value enum +func (m *NetworkSecurityGroupRule) validateActionEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkSecurityGroupRuleTypeActionPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *NetworkSecurityGroupRule) validateAction(formats strfmt.Registry) error { + + if err := validate.Required("action", "body", m.Action); err != nil { + return err + } + + // value enum + if err := m.validateActionEnum("action", "body", *m.Action); err != nil { + return err + } + + return nil +} + +func (m *NetworkSecurityGroupRule) validateDestinationPort(formats strfmt.Registry) error { + if swag.IsZero(m.DestinationPort) { // not required + return nil + } + + if m.DestinationPort != nil { + if err := m.DestinationPort.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("destinationPort") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("destinationPort") + } + return err + } + } + + return nil +} + +var networkSecurityGroupRuleTypeDirectionPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["inbound","outbound"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkSecurityGroupRuleTypeDirectionPropEnum = append(networkSecurityGroupRuleTypeDirectionPropEnum, v) + } +} + +const ( + + // NetworkSecurityGroupRuleDirectionInbound captures enum value "inbound" + NetworkSecurityGroupRuleDirectionInbound string = "inbound" + + // NetworkSecurityGroupRuleDirectionOutbound captures enum value "outbound" + NetworkSecurityGroupRuleDirectionOutbound string = "outbound" +) + +// prop value enum +func (m *NetworkSecurityGroupRule) validateDirectionEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkSecurityGroupRuleTypeDirectionPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *NetworkSecurityGroupRule) validateDirection(formats strfmt.Registry) error { + + if err := validate.Required("direction", "body", m.Direction); err != nil { + return err + } + + // value enum + if err := m.validateDirectionEnum("direction", "body", *m.Direction); err != nil { + return err + } + + return nil +} + +func (m *NetworkSecurityGroupRule) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *NetworkSecurityGroupRule) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *NetworkSecurityGroupRule) validateProtocol(formats strfmt.Registry) error { + + if err := validate.Required("protocol", "body", m.Protocol); err != nil { + return err + } + + if m.Protocol != nil { + if err := m.Protocol.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("protocol") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("protocol") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupRule) validateRemote(formats strfmt.Registry) error { + + if err := validate.Required("remote", "body", m.Remote); err != nil { + return err + } + + if m.Remote != nil { + if err := m.Remote.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("remote") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("remote") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupRule) validateSourcePort(formats strfmt.Registry) error { + if swag.IsZero(m.SourcePort) { // not required + return nil + } + + if m.SourcePort != nil { + if err := m.SourcePort.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sourcePort") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sourcePort") + } + return err + } + } + + return nil +} + +// ContextValidate validate this network security group rule based on the context it is used +func (m *NetworkSecurityGroupRule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDestinationPort(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateProtocol(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRemote(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSourcePort(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroupRule) contextValidateDestinationPort(ctx context.Context, formats strfmt.Registry) error { + + if m.DestinationPort != nil { + + if swag.IsZero(m.DestinationPort) { // not required + return nil + } + + if err := m.DestinationPort.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("destinationPort") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("destinationPort") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupRule) contextValidateProtocol(ctx context.Context, formats strfmt.Registry) error { + + if m.Protocol != nil { + + if err := m.Protocol.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("protocol") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("protocol") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupRule) contextValidateRemote(ctx context.Context, formats strfmt.Registry) error { + + if m.Remote != nil { + + if err := m.Remote.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("remote") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("remote") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupRule) contextValidateSourcePort(ctx context.Context, formats strfmt.Registry) error { + + if m.SourcePort != nil { + + if swag.IsZero(m.SourcePort) { // not required + return nil + } + + if err := m.SourcePort.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sourcePort") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sourcePort") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupRule) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupRule) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupRule + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group_rule_port.go b/power/models/network_security_group_rule_port.go new file mode 100644 index 00000000..9038f803 --- /dev/null +++ b/power/models/network_security_group_rule_port.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" +) + +// NetworkSecurityGroupRulePort network security group rule port +// +// swagger:model NetworkSecurityGroupRulePort +type NetworkSecurityGroupRulePort struct { + + // The end of the port range, if applicable, If values are not present then all ports are in the range + Maximum float64 `json:"maximum,omitempty"` + + // The start of the port range, if applicable. If values are not present then all ports are in the range + Minimum float64 `json:"minimum,omitempty"` +} + +// Validate validates this network security group rule port +func (m *NetworkSecurityGroupRulePort) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this network security group rule port based on context it is used +func (m *NetworkSecurityGroupRulePort) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupRulePort) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupRulePort) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupRulePort + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group_rule_protocol.go b/power/models/network_security_group_rule_protocol.go new file mode 100644 index 00000000..e76368cc --- /dev/null +++ b/power/models/network_security_group_rule_protocol.go @@ -0,0 +1,182 @@ +// 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" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkSecurityGroupRuleProtocol network security group rule protocol +// +// swagger:model NetworkSecurityGroupRuleProtocol +type NetworkSecurityGroupRuleProtocol struct { + + // If icmp type, the list of ICMP packet types (by numbers) affected by ICMP rules and if not present then all types are matched + IcmpTypes []float64 `json:"icmpTypes"` + + // If tcp type, the list of TCP flags and if not present then all flags are matched + TCPFlags []*NetworkSecurityGroupRuleProtocolTCPFlag `json:"tcpFlags"` + + // The protocol of the network traffic + // Enum: ["icmp","tcp","udp","all"] + Type string `json:"type,omitempty"` +} + +// Validate validates this network security group rule protocol +func (m *NetworkSecurityGroupRuleProtocol) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTCPFlags(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 *NetworkSecurityGroupRuleProtocol) validateTCPFlags(formats strfmt.Registry) error { + if swag.IsZero(m.TCPFlags) { // not required + return nil + } + + for i := 0; i < len(m.TCPFlags); i++ { + if swag.IsZero(m.TCPFlags[i]) { // not required + continue + } + + if m.TCPFlags[i] != nil { + if err := m.TCPFlags[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tcpFlags" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tcpFlags" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +var networkSecurityGroupRuleProtocolTypeTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["icmp","tcp","udp","all"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkSecurityGroupRuleProtocolTypeTypePropEnum = append(networkSecurityGroupRuleProtocolTypeTypePropEnum, v) + } +} + +const ( + + // NetworkSecurityGroupRuleProtocolTypeIcmp captures enum value "icmp" + NetworkSecurityGroupRuleProtocolTypeIcmp string = "icmp" + + // NetworkSecurityGroupRuleProtocolTypeTCP captures enum value "tcp" + NetworkSecurityGroupRuleProtocolTypeTCP string = "tcp" + + // NetworkSecurityGroupRuleProtocolTypeUDP captures enum value "udp" + NetworkSecurityGroupRuleProtocolTypeUDP string = "udp" + + // NetworkSecurityGroupRuleProtocolTypeAll captures enum value "all" + NetworkSecurityGroupRuleProtocolTypeAll string = "all" +) + +// prop value enum +func (m *NetworkSecurityGroupRuleProtocol) validateTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkSecurityGroupRuleProtocolTypeTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *NetworkSecurityGroupRuleProtocol) validateType(formats strfmt.Registry) error { + if swag.IsZero(m.Type) { // not required + return nil + } + + // value enum + if err := m.validateTypeEnum("type", "body", m.Type); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this network security group rule protocol based on the context it is used +func (m *NetworkSecurityGroupRuleProtocol) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTCPFlags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroupRuleProtocol) contextValidateTCPFlags(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TCPFlags); i++ { + + if m.TCPFlags[i] != nil { + + if swag.IsZero(m.TCPFlags[i]) { // not required + return nil + } + + if err := m.TCPFlags[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tcpFlags" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tcpFlags" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupRuleProtocol) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupRuleProtocol) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupRuleProtocol + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group_rule_protocol_tcp_flag.go b/power/models/network_security_group_rule_protocol_tcp_flag.go new file mode 100644 index 00000000..559651c5 --- /dev/null +++ b/power/models/network_security_group_rule_protocol_tcp_flag.go @@ -0,0 +1,126 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkSecurityGroupRuleProtocolTCPFlag network security group rule protocol Tcp flag +// +// swagger:model NetworkSecurityGroupRuleProtocolTcpFlag +type NetworkSecurityGroupRuleProtocolTCPFlag struct { + + // TCP flag + // Enum: ["syn","ack","fin","rst","urg","psh","wnd","chk","seq"] + Flag string `json:"flag,omitempty"` +} + +// Validate validates this network security group rule protocol Tcp flag +func (m *NetworkSecurityGroupRuleProtocolTCPFlag) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateFlag(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var networkSecurityGroupRuleProtocolTcpFlagTypeFlagPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["syn","ack","fin","rst","urg","psh","wnd","chk","seq"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkSecurityGroupRuleProtocolTcpFlagTypeFlagPropEnum = append(networkSecurityGroupRuleProtocolTcpFlagTypeFlagPropEnum, v) + } +} + +const ( + + // NetworkSecurityGroupRuleProtocolTCPFlagFlagSyn captures enum value "syn" + NetworkSecurityGroupRuleProtocolTCPFlagFlagSyn string = "syn" + + // NetworkSecurityGroupRuleProtocolTCPFlagFlagAck captures enum value "ack" + NetworkSecurityGroupRuleProtocolTCPFlagFlagAck string = "ack" + + // NetworkSecurityGroupRuleProtocolTCPFlagFlagFin captures enum value "fin" + NetworkSecurityGroupRuleProtocolTCPFlagFlagFin string = "fin" + + // NetworkSecurityGroupRuleProtocolTCPFlagFlagRst captures enum value "rst" + NetworkSecurityGroupRuleProtocolTCPFlagFlagRst string = "rst" + + // NetworkSecurityGroupRuleProtocolTCPFlagFlagUrg captures enum value "urg" + NetworkSecurityGroupRuleProtocolTCPFlagFlagUrg string = "urg" + + // NetworkSecurityGroupRuleProtocolTCPFlagFlagPsh captures enum value "psh" + NetworkSecurityGroupRuleProtocolTCPFlagFlagPsh string = "psh" + + // NetworkSecurityGroupRuleProtocolTCPFlagFlagWnd captures enum value "wnd" + NetworkSecurityGroupRuleProtocolTCPFlagFlagWnd string = "wnd" + + // NetworkSecurityGroupRuleProtocolTCPFlagFlagChk captures enum value "chk" + NetworkSecurityGroupRuleProtocolTCPFlagFlagChk string = "chk" + + // NetworkSecurityGroupRuleProtocolTCPFlagFlagSeq captures enum value "seq" + NetworkSecurityGroupRuleProtocolTCPFlagFlagSeq string = "seq" +) + +// prop value enum +func (m *NetworkSecurityGroupRuleProtocolTCPFlag) validateFlagEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkSecurityGroupRuleProtocolTcpFlagTypeFlagPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *NetworkSecurityGroupRuleProtocolTCPFlag) validateFlag(formats strfmt.Registry) error { + if swag.IsZero(m.Flag) { // not required + return nil + } + + // value enum + if err := m.validateFlagEnum("flag", "body", m.Flag); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network security group rule protocol Tcp flag based on context it is used +func (m *NetworkSecurityGroupRuleProtocolTCPFlag) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupRuleProtocolTCPFlag) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupRuleProtocolTCPFlag) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupRuleProtocolTCPFlag + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group_rule_remote.go b/power/models/network_security_group_rule_remote.go new file mode 100644 index 00000000..47426697 --- /dev/null +++ b/power/models/network_security_group_rule_remote.go @@ -0,0 +1,111 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkSecurityGroupRuleRemote network security group rule remote +// +// swagger:model NetworkSecurityGroupRuleRemote +type NetworkSecurityGroupRuleRemote struct { + + // The ID of the remote Network Address Group or Network Security Group the rules apply to. Not required for default-network-address-group + ID string `json:"id,omitempty"` + + // The type of remote group the rules apply to + // Enum: ["network-security-group","network-address-group","default-network-address-group"] + Type string `json:"type,omitempty"` +} + +// Validate validates this network security group rule remote +func (m *NetworkSecurityGroupRuleRemote) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateType(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var networkSecurityGroupRuleRemoteTypeTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["network-security-group","network-address-group","default-network-address-group"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkSecurityGroupRuleRemoteTypeTypePropEnum = append(networkSecurityGroupRuleRemoteTypeTypePropEnum, v) + } +} + +const ( + + // NetworkSecurityGroupRuleRemoteTypeNetworkDashSecurityDashGroup captures enum value "network-security-group" + NetworkSecurityGroupRuleRemoteTypeNetworkDashSecurityDashGroup string = "network-security-group" + + // NetworkSecurityGroupRuleRemoteTypeNetworkDashAddressDashGroup captures enum value "network-address-group" + NetworkSecurityGroupRuleRemoteTypeNetworkDashAddressDashGroup string = "network-address-group" + + // NetworkSecurityGroupRuleRemoteTypeDefaultDashNetworkDashAddressDashGroup captures enum value "default-network-address-group" + NetworkSecurityGroupRuleRemoteTypeDefaultDashNetworkDashAddressDashGroup string = "default-network-address-group" +) + +// prop value enum +func (m *NetworkSecurityGroupRuleRemote) validateTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkSecurityGroupRuleRemoteTypeTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *NetworkSecurityGroupRuleRemote) validateType(formats strfmt.Registry) error { + if swag.IsZero(m.Type) { // not required + return nil + } + + // value enum + if err := m.validateTypeEnum("type", "body", m.Type); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network security group rule remote based on context it is used +func (m *NetworkSecurityGroupRuleRemote) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupRuleRemote) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupRuleRemote) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupRuleRemote + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group_update.go b/power/models/network_security_group_update.go new file mode 100644 index 00000000..a9d97709 --- /dev/null +++ b/power/models/network_security_group_update.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" +) + +// NetworkSecurityGroupUpdate network security group update +// +// swagger:model NetworkSecurityGroupUpdate +type NetworkSecurityGroupUpdate struct { + + // Replaces the current Network Security Group Name + Name string `json:"name,omitempty"` +} + +// Validate validates this network security group update +func (m *NetworkSecurityGroupUpdate) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this network security group update based on context it is used +func (m *NetworkSecurityGroupUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupUpdate) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_groups.go b/power/models/network_security_groups.go new file mode 100644 index 00000000..82d72f87 --- /dev/null +++ b/power/models/network_security_groups.go @@ -0,0 +1,121 @@ +// 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" +) + +// NetworkSecurityGroups network security groups +// +// swagger:model NetworkSecurityGroups +type NetworkSecurityGroups struct { + + // list of Network Security Groups + NetworkSecurityGroups []*NetworkSecurityGroup `json:"networkSecurityGroups"` +} + +// Validate validates this network security groups +func (m *NetworkSecurityGroups) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateNetworkSecurityGroups(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroups) validateNetworkSecurityGroups(formats strfmt.Registry) error { + if swag.IsZero(m.NetworkSecurityGroups) { // not required + return nil + } + + for i := 0; i < len(m.NetworkSecurityGroups); i++ { + if swag.IsZero(m.NetworkSecurityGroups[i]) { // not required + continue + } + + if m.NetworkSecurityGroups[i] != nil { + if err := m.NetworkSecurityGroups[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networkSecurityGroups" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networkSecurityGroups" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this network security groups based on the context it is used +func (m *NetworkSecurityGroups) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateNetworkSecurityGroups(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroups) contextValidateNetworkSecurityGroups(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.NetworkSecurityGroups); i++ { + + if m.NetworkSecurityGroups[i] != nil { + + if swag.IsZero(m.NetworkSecurityGroups[i]) { // not required + return nil + } + + if err := m.NetworkSecurityGroups[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networkSecurityGroups" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networkSecurityGroups" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroups) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroups) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroups + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_groups_action.go b/power/models/network_security_groups_action.go new file mode 100644 index 00000000..ad9b218a --- /dev/null +++ b/power/models/network_security_groups_action.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkSecurityGroupsAction network security groups action +// +// swagger:model NetworkSecurityGroupsAction +type NetworkSecurityGroupsAction struct { + + // Name of the action to take; can be enable to enable NSGs in a workspace or disable to disable NSGs in a workspace + // Required: true + // Enum: ["enable","disable"] + Action *string `json:"action"` +} + +// Validate validates this network security groups action +func (m *NetworkSecurityGroupsAction) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAction(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var networkSecurityGroupsActionTypeActionPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["enable","disable"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkSecurityGroupsActionTypeActionPropEnum = append(networkSecurityGroupsActionTypeActionPropEnum, v) + } +} + +const ( + + // NetworkSecurityGroupsActionActionEnable captures enum value "enable" + NetworkSecurityGroupsActionActionEnable string = "enable" + + // NetworkSecurityGroupsActionActionDisable captures enum value "disable" + NetworkSecurityGroupsActionActionDisable string = "disable" +) + +// prop value enum +func (m *NetworkSecurityGroupsAction) validateActionEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkSecurityGroupsActionTypeActionPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *NetworkSecurityGroupsAction) validateAction(formats strfmt.Registry) error { + + if err := validate.Required("action", "body", m.Action); err != nil { + return err + } + + // value enum + if err := m.validateActionEnum("action", "body", *m.Action); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network security groups action based on context it is used +func (m *NetworkSecurityGroupsAction) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupsAction) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupsAction) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupsAction + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/workspace_details.go b/power/models/workspace_details.go index a74e2ebe..a26cc6ea 100644 --- a/power/models/workspace_details.go +++ b/power/models/workspace_details.go @@ -31,6 +31,9 @@ type WorkspaceDetails struct { // Link to Workspace Resource Href string `json:"href,omitempty"` + // The Workspace Network Security Groups information + NetworkSecurityGroups *WorkspaceNetworkSecurityGroupsDetails `json:"networkSecurityGroups,omitempty"` + // The Workspace Power Edge Router information PowerEdgeRouter *WorkspacePowerEdgeRouterDetails `json:"powerEdgeRouter,omitempty"` } @@ -47,6 +50,10 @@ func (m *WorkspaceDetails) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateNetworkSecurityGroups(formats); err != nil { + res = append(res, err) + } + if err := m.validatePowerEdgeRouter(formats); err != nil { res = append(res, err) } @@ -79,6 +86,25 @@ func (m *WorkspaceDetails) validateCrn(formats strfmt.Registry) error { return nil } +func (m *WorkspaceDetails) validateNetworkSecurityGroups(formats strfmt.Registry) error { + if swag.IsZero(m.NetworkSecurityGroups) { // not required + return nil + } + + if m.NetworkSecurityGroups != nil { + if err := m.NetworkSecurityGroups.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networkSecurityGroups") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networkSecurityGroups") + } + return err + } + } + + return nil +} + func (m *WorkspaceDetails) validatePowerEdgeRouter(formats strfmt.Registry) error { if swag.IsZero(m.PowerEdgeRouter) { // not required return nil @@ -102,6 +128,10 @@ func (m *WorkspaceDetails) validatePowerEdgeRouter(formats strfmt.Registry) erro func (m *WorkspaceDetails) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error + if err := m.contextValidateNetworkSecurityGroups(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidatePowerEdgeRouter(ctx, formats); err != nil { res = append(res, err) } @@ -112,6 +142,27 @@ func (m *WorkspaceDetails) ContextValidate(ctx context.Context, formats strfmt.R return nil } +func (m *WorkspaceDetails) contextValidateNetworkSecurityGroups(ctx context.Context, formats strfmt.Registry) error { + + if m.NetworkSecurityGroups != nil { + + if swag.IsZero(m.NetworkSecurityGroups) { // not required + return nil + } + + if err := m.NetworkSecurityGroups.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networkSecurityGroups") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networkSecurityGroups") + } + return err + } + } + + return nil +} + func (m *WorkspaceDetails) contextValidatePowerEdgeRouter(ctx context.Context, formats strfmt.Registry) error { if m.PowerEdgeRouter != nil { diff --git a/power/models/workspace_network_security_groups_details.go b/power/models/workspace_network_security_groups_details.go new file mode 100644 index 00000000..b2977339 --- /dev/null +++ b/power/models/workspace_network_security_groups_details.go @@ -0,0 +1,116 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// WorkspaceNetworkSecurityGroupsDetails workspace network security groups details +// +// swagger:model WorkspaceNetworkSecurityGroupsDetails +type WorkspaceNetworkSecurityGroupsDetails struct { + + // The state of a Network Security Groups configuration + // Required: true + // Enum: ["active","error","configuring","removing","inactive"] + State *string `json:"state"` +} + +// Validate validates this workspace network security groups details +func (m *WorkspaceNetworkSecurityGroupsDetails) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateState(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var workspaceNetworkSecurityGroupsDetailsTypeStatePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["active","error","configuring","removing","inactive"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + workspaceNetworkSecurityGroupsDetailsTypeStatePropEnum = append(workspaceNetworkSecurityGroupsDetailsTypeStatePropEnum, v) + } +} + +const ( + + // WorkspaceNetworkSecurityGroupsDetailsStateActive captures enum value "active" + WorkspaceNetworkSecurityGroupsDetailsStateActive string = "active" + + // WorkspaceNetworkSecurityGroupsDetailsStateError captures enum value "error" + WorkspaceNetworkSecurityGroupsDetailsStateError string = "error" + + // WorkspaceNetworkSecurityGroupsDetailsStateConfiguring captures enum value "configuring" + WorkspaceNetworkSecurityGroupsDetailsStateConfiguring string = "configuring" + + // WorkspaceNetworkSecurityGroupsDetailsStateRemoving captures enum value "removing" + WorkspaceNetworkSecurityGroupsDetailsStateRemoving string = "removing" + + // WorkspaceNetworkSecurityGroupsDetailsStateInactive captures enum value "inactive" + WorkspaceNetworkSecurityGroupsDetailsStateInactive string = "inactive" +) + +// prop value enum +func (m *WorkspaceNetworkSecurityGroupsDetails) validateStateEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, workspaceNetworkSecurityGroupsDetailsTypeStatePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *WorkspaceNetworkSecurityGroupsDetails) validateState(formats strfmt.Registry) error { + + if err := validate.Required("state", "body", m.State); err != nil { + return err + } + + // value enum + if err := m.validateStateEnum("state", "body", *m.State); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this workspace network security groups details based on context it is used +func (m *WorkspaceNetworkSecurityGroupsDetails) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *WorkspaceNetworkSecurityGroupsDetails) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *WorkspaceNetworkSecurityGroupsDetails) UnmarshalBinary(b []byte) error { + var res WorkspaceNetworkSecurityGroupsDetails + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} From 84f5e0127ecff43fda53fb8f68a91961ee2ef64c Mon Sep 17 00:00:00 2001 From: ismirlia <90468712+ismirlia@users.noreply.github.com> Date: Mon, 29 Jul 2024 15:16:40 -0500 Subject: [PATCH 055/123] Block gateway network update for stratos (#429) --- clients/instance/ibm-pi-network.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clients/instance/ibm-pi-network.go b/clients/instance/ibm-pi-network.go index a813bc42..28ec4be0 100644 --- a/clients/instance/ibm-pi-network.go +++ b/clients/instance/ibm-pi-network.go @@ -79,6 +79,10 @@ func (f *IBMPINetworkClient) Create(body *models.NetworkCreate) (*models.Network // Update a Network func (f *IBMPINetworkClient) Update(id string, body *models.NetworkUpdate) (*models.Network, error) { + // Check for satellite differences in this endpoint + if f.session.IsOnPrem() && body.Gateway != nil { + return nil, fmt.Errorf("gateway parameter is not supported in satellite location, check documentation") + } params := p_cloud_networks.NewPcloudNetworksPutParams(). WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithNetworkID(id). From e3b972baeee9c88b961273c7e622a9feab680ddf Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Tue, 6 Aug 2024 17:29:35 -0500 Subject: [PATCH 056/123] Generated Swagger client from service-broker commit f82abb1277ab5b723c24869c6428d76919342fed (#438) --- power/models/capability_details.go | 157 -------------------------- power/models/replication_services.go | 159 --------------------------- 2 files changed, 316 deletions(-) delete mode 100644 power/models/capability_details.go delete mode 100644 power/models/replication_services.go diff --git a/power/models/capability_details.go b/power/models/capability_details.go deleted file mode 100644 index 1b2c0f42..00000000 --- a/power/models/capability_details.go +++ /dev/null @@ -1,157 +0,0 @@ -// 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" -) - -// CapabilityDetails capability details -// -// swagger:model CapabilityDetails -type CapabilityDetails struct { - - // Disaster Recovery Information - // Required: true - DisasterRecovery *DisasterRecovery `json:"disasterRecovery"` - - // Datacenter System Types Information - // Required: true - SupportedSystems *SupportedSystems `json:"supportedSystems"` -} - -// Validate validates this capability details -func (m *CapabilityDetails) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateDisasterRecovery(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSupportedSystems(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *CapabilityDetails) validateDisasterRecovery(formats strfmt.Registry) error { - - if err := validate.Required("disasterRecovery", "body", m.DisasterRecovery); err != nil { - return err - } - - if m.DisasterRecovery != nil { - if err := m.DisasterRecovery.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("disasterRecovery") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("disasterRecovery") - } - return err - } - } - - return nil -} - -func (m *CapabilityDetails) validateSupportedSystems(formats strfmt.Registry) error { - - if err := validate.Required("supportedSystems", "body", m.SupportedSystems); err != nil { - return err - } - - if m.SupportedSystems != nil { - if err := m.SupportedSystems.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("supportedSystems") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("supportedSystems") - } - return err - } - } - - return nil -} - -// ContextValidate validate this capability details based on the context it is used -func (m *CapabilityDetails) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateDisasterRecovery(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateSupportedSystems(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *CapabilityDetails) contextValidateDisasterRecovery(ctx context.Context, formats strfmt.Registry) error { - - if m.DisasterRecovery != nil { - - if err := m.DisasterRecovery.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("disasterRecovery") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("disasterRecovery") - } - return err - } - } - - return nil -} - -func (m *CapabilityDetails) contextValidateSupportedSystems(ctx context.Context, formats strfmt.Registry) error { - - if m.SupportedSystems != nil { - - if err := m.SupportedSystems.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("supportedSystems") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("supportedSystems") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *CapabilityDetails) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *CapabilityDetails) UnmarshalBinary(b []byte) error { - var res CapabilityDetails - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/power/models/replication_services.go b/power/models/replication_services.go deleted file mode 100644 index 637125d0..00000000 --- a/power/models/replication_services.go +++ /dev/null @@ -1,159 +0,0 @@ -// 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" -) - -// ReplicationServices replication services -// -// swagger:model ReplicationServices -type ReplicationServices struct { - - // Asynchronous Replication Target Information - // Required: true - AsynchronousReplication *ReplicationService `json:"asynchronousReplication"` - - // Synchronous Replication Target Information - SynchronousReplication *ReplicationService `json:"synchronousReplication,omitempty"` -} - -// Validate validates this replication services -func (m *ReplicationServices) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateAsynchronousReplication(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSynchronousReplication(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *ReplicationServices) validateAsynchronousReplication(formats strfmt.Registry) error { - - if err := validate.Required("asynchronousReplication", "body", m.AsynchronousReplication); err != nil { - return err - } - - if m.AsynchronousReplication != nil { - if err := m.AsynchronousReplication.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("asynchronousReplication") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("asynchronousReplication") - } - return err - } - } - - return nil -} - -func (m *ReplicationServices) validateSynchronousReplication(formats strfmt.Registry) error { - if swag.IsZero(m.SynchronousReplication) { // not required - return nil - } - - if m.SynchronousReplication != nil { - if err := m.SynchronousReplication.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("synchronousReplication") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("synchronousReplication") - } - return err - } - } - - return nil -} - -// ContextValidate validate this replication services based on the context it is used -func (m *ReplicationServices) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateAsynchronousReplication(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateSynchronousReplication(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *ReplicationServices) contextValidateAsynchronousReplication(ctx context.Context, formats strfmt.Registry) error { - - if m.AsynchronousReplication != nil { - - if err := m.AsynchronousReplication.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("asynchronousReplication") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("asynchronousReplication") - } - return err - } - } - - return nil -} - -func (m *ReplicationServices) contextValidateSynchronousReplication(ctx context.Context, formats strfmt.Registry) error { - - if m.SynchronousReplication != nil { - - if swag.IsZero(m.SynchronousReplication) { // not required - return nil - } - - if err := m.SynchronousReplication.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("synchronousReplication") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("synchronousReplication") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *ReplicationServices) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ReplicationServices) UnmarshalBinary(b []byte) error { - var res ReplicationServices - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} From db60d1ac9c20dfd6a535986a07c721c8fa162542 Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Tue, 6 Aug 2024 17:30:31 -0500 Subject: [PATCH 057/123] Add Network Address Group (#435) --- .../instance/ibmi-pi-network-address-group.go | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 clients/instance/ibmi-pi-network-address-group.go diff --git a/clients/instance/ibmi-pi-network-address-group.go b/clients/instance/ibmi-pi-network-address-group.go new file mode 100644 index 00000000..16695a20 --- /dev/null +++ b/clients/instance/ibmi-pi-network-address-group.go @@ -0,0 +1,117 @@ +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_address_groups" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPINetworkAddressGroupClient +type IBMPINetworkAddressGroupClient struct { + IBMPIClient +} + +// NewIBMPINetworkAddressGroupClient +func NewIBMPINetworkAddressGroupClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPINetworkAddressGroupClient { + return &IBMPINetworkAddressGroupClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// Create a new Network Address Group +func (f *IBMPINetworkAddressGroupClient) Create(body *models.NetworkAddressGroupCreate) (*models.NetworkAddressGroup, error) { + params := network_address_groups.NewV1NetworkAddressGroupsPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithBody(body) + postok, postcreated, err := f.session.Power.NetworkAddressGroups.V1NetworkAddressGroupsPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to create a network address group %s", err)) + } + if postok != nil && postok.Payload != nil { + return postok.Payload, nil + } + if postcreated != nil && postcreated.Payload != nil { + return postcreated.Payload, nil + } + return nil, fmt.Errorf("failed to create a network address group") +} + +// Get the list of Network Address Groups for a workspace +func (f *IBMPINetworkAddressGroupClient) GetAll() (*models.NetworkAddressGroups, error) { + params := network_address_groups.NewV1NetworkAddressGroupsGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut) + resp, err := f.session.Power.NetworkAddressGroups.V1NetworkAddressGroupsGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to get network address groups %s", err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get network address groups") + } + return resp.Payload, nil + +} + +// Get the detail of a Network Address Group +func (f *IBMPINetworkAddressGroupClient) Get(id string) (*models.NetworkAddressGroup, error) { + params := network_address_groups.NewV1NetworkAddressGroupsIDGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithNetworkAddressGroupID(id) + resp, err := f.session.Power.NetworkAddressGroups.V1NetworkAddressGroupsIDGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to get network address group %s: %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get network address group %s", id) + } + return resp.Payload, nil + +} + +// Update a Network Address Group +func (f *IBMPINetworkAddressGroupClient) Update(id string, body *models.NetworkAddressGroupUpdate) (*models.NetworkAddressGroup, error) { + params := network_address_groups.NewV1NetworkAddressGroupsIDPutParams().WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut) + resp, err := f.session.Power.NetworkAddressGroups.V1NetworkAddressGroupsIDPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to update network address group %s: %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to update network address group %s", id) + } + return resp.Payload, nil +} + +// Delete a Network Address Group from a workspace +func (f *IBMPINetworkAddressGroupClient) Delete(id string) error { + params := network_address_groups.NewV1NetworkAddressGroupsIDDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut).WithNetworkAddressGroupID(id) + _, err := f.session.Power.NetworkAddressGroups.V1NetworkAddressGroupsIDDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf("failed to delete network address group %s: %w", id, err) + } + return nil +} + +// Add a member to a Network Address Group +func (f *IBMPINetworkAddressGroupClient) AddMember(id string, body *models.NetworkAddressGroupAddMember) (*models.NetworkAddressGroup, error) { + params := network_address_groups.NewV1NetworkAddressGroupsMembersPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithNetworkAddressGroupID(id) + resp, err := f.session.Power.NetworkAddressGroups.V1NetworkAddressGroupsMembersPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to add member to network address group %s: %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to add member to network address group %s", id) + } + return resp.Payload, nil +} + +// Delete the member from a Network Address Group +func (f *IBMPINetworkAddressGroupClient) DeleteMember(id, memberId string) (*models.NetworkAddressGroup, error) { + params := network_address_groups.NewV1NetworkAddressGroupsMembersDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut).WithNetworkAddressGroupID(id).WithNetworkAddressGroupMemberID(memberId) + resp, err := f.session.Power.NetworkAddressGroups.V1NetworkAddressGroupsMembersDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to delete member %s from network address group %s: %w", memberId, id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to delete member %s from network address group %s", memberId, id) + } + return resp.Payload, nil + +} From 9709fc63464a2572e3e9685ca45bc87e0f3d982d Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Wed, 7 Aug 2024 09:17:57 -0500 Subject: [PATCH 058/123] Network Security Group (#434) * Network Security Group * Add nsg action --- .../instance/ibm-pi-network-security-group.go | 150 ++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 clients/instance/ibm-pi-network-security-group.go diff --git a/clients/instance/ibm-pi-network-security-group.go b/clients/instance/ibm-pi-network-security-group.go new file mode 100644 index 00000000..e5ba9ce4 --- /dev/null +++ b/clients/instance/ibm-pi-network-security-group.go @@ -0,0 +1,150 @@ +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_security_groups" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPINetworkSecurityGroupClient +type IBMPINetworkSecurityGroupClient struct { + IBMPIClient +} + +// NewIBMIPINetworkSecurityGroupClient +func NewIBMIPINetworkSecurityGroupClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPINetworkSecurityGroupClient { + return &IBMPINetworkSecurityGroupClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// Get a network security group +func (f *IBMPINetworkSecurityGroupClient) Get(id string) (*models.NetworkSecurityGroup, error) { + params := network_security_groups.NewV1NetworkSecurityGroupsIDGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithNetworkSecurityGroupID(id) + resp, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsIDGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to get network security group %s: %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get network security group %s", id) + } + return resp.Payload, nil +} + +// Get all network security groups +func (f *IBMPINetworkSecurityGroupClient) GetAll() (*models.NetworkSecurityGroups, error) { + params := network_security_groups.NewV1NetworkSecurityGroupsListParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut) + resp, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsList(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to get network security groups %s", err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get network security groups") + } + return resp.Payload, nil +} + +// Create a network security group +func (f *IBMPINetworkSecurityGroupClient) Create(body *models.NetworkSecurityGroupCreate) (*models.NetworkSecurityGroup, error) { + params := network_security_groups.NewV1NetworkSecurityGroupsPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithBody(body) + postok, postcreated, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to create a network security group %s", err)) + } + if postok != nil && postok.Payload != nil { + return postok.Payload, nil + } + if postcreated != nil && postcreated.Payload != nil { + return postcreated.Payload, nil + } + return nil, fmt.Errorf("failed to create a network security group") +} + +// Update a network security group +func (f *IBMPINetworkSecurityGroupClient) Update(id string, body *models.NetworkSecurityGroupUpdate) (*models.NetworkSecurityGroup, error) { + params := network_security_groups.NewV1NetworkSecurityGroupsIDPutParams().WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut).WithNetworkSecurityGroupID(id).WithBody(body) + resp, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsIDPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to update network security group %s: %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to update network security group %s", id) + } + return resp.Payload, nil +} + +// Delete a network security group +func (f *IBMPINetworkSecurityGroupClient) Delete(id string) error { + params := network_security_groups.NewV1NetworkSecurityGroupsIDDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut).WithNetworkSecurityGroupID(id) + _, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsIDDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf("failed to delete network security group %s: %w", id, err) + } + return nil +} + +// Add a member to a network security group +func (f *IBMPINetworkSecurityGroupClient) AddMember(id string, body *models.NetworkSecurityGroupAddMember) (*models.NetworkSecurityGroup, error) { + params := network_security_groups.NewV1NetworkSecurityGroupsMembersPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithNetworkSecurityGroupID(id).WithBody(body) + resp, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsMembersPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to add member to network security group %s: %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to add member to network security group %s", id) + } + return resp.Payload, nil +} + +// Deleta a member from a network securti group +func (f *IBMPINetworkSecurityGroupClient) DeleteMember(id, memberId string) (*models.NetworkSecurityGroup, error) { + params := network_security_groups.NewV1NetworkSecurityGroupsMembersDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut).WithNetworkSecurityGroupID(id).WithNetworkSecurityGroupMemberID(memberId) + resp, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsMembersDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to delete member %s from network security group %s: %w", memberId, id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to delete member %s from network security group %s", memberId, id) + } + return resp.Payload, nil +} + +// Add a rule to a network security group +func (f *IBMPINetworkSecurityGroupClient) AddRule(id string, body *models.NetworkSecurityGroupAddRule) (*models.NetworkSecurityGroup, error) { + params := network_security_groups.NewV1NetworkSecurityGroupsRulesPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithNetworkSecurityGroupID(id).WithBody(body) + resp, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsRulesPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to add rule to network security group %s: %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to add rule to network security group %s", id) + } + return resp.Payload, nil +} + +// Delete a rule from a network security group +func (f *IBMPINetworkSecurityGroupClient) DeleteRule(id, ruleId string) (*models.NetworkSecurityGroup, error) { + params := network_security_groups.NewV1NetworkSecurityGroupsRulesDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut).WithNetworkSecurityGroupID(id).WithNetworkSecurityGroupRuleID(ruleId) + resp, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsRulesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to delete rule %s from network security group %s: %w", ruleId, id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to delete rule %s from network security group %s", ruleId, id) + } + return resp.Payload, nil +} + +// Action on a network security group +func (f *IBMPINetworkSecurityGroupClient) Action(body *models.NetworkSecurityGroupsAction) error { + params := network_security_groups.NewV1NetworkSecurityGroupsActionPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithBody(body) + _, _, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsActionPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf("failed to perform action :%w", err) + } + return nil +} From aa5beac4aafda10fd0332b4d2fd71ff833cf5d9f Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Wed, 7 Aug 2024 13:19:24 -0500 Subject: [PATCH 059/123] Generated Swagger client from service-broker commit 8ef4989190f08ba3544a8958ccbb5aeb3cab15dd (#439) --- .../p_cloud_virtual_serial_number_client.go | 106 ++++ ...virtual_serial_number_getall_parameters.go | 151 ++++++ ..._virtual_serial_number_getall_responses.go | 484 ++++++++++++++++++ power/client/power_iaas_api_client.go | 5 + power/models/virtual_serial_number.go | 56 ++ power/models/virtual_serial_number_list.go | 78 +++ 6 files changed, 880 insertions(+) create mode 100644 power/client/p_cloud_virtual_serial_number/p_cloud_virtual_serial_number_client.go create mode 100644 power/client/p_cloud_virtual_serial_number/pcloud_cloudinstances_virtual_serial_number_getall_parameters.go create mode 100644 power/client/p_cloud_virtual_serial_number/pcloud_cloudinstances_virtual_serial_number_getall_responses.go create mode 100644 power/models/virtual_serial_number.go create mode 100644 power/models/virtual_serial_number_list.go 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..3366927f --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/p_cloud_virtual_serial_number_client.go @@ -0,0 +1,106 @@ +// 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 { + PcloudCloudinstancesVirtualSerialNumberGetall(params *PcloudCloudinstancesVirtualSerialNumberGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVirtualSerialNumberGetallOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +PcloudCloudinstancesVirtualSerialNumberGetall lists all retained v s ns this cloud instance +*/ +func (a *Client) PcloudCloudinstancesVirtualSerialNumberGetall(params *PcloudCloudinstancesVirtualSerialNumberGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVirtualSerialNumberGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesVirtualSerialNumberGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.virtual-serial-number.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/virtual-serial-number", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesVirtualSerialNumberGetallReader{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.(*PcloudCloudinstancesVirtualSerialNumberGetallOK) + 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.cloudinstances.virtual-serial-number.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/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/power_iaas_api_client.go b/power/client/power_iaas_api_client.go index 6a25d818..4f41fd5a 100644 --- a/power/client/power_iaas_api_client.go +++ b/power/client/power_iaas_api_client.go @@ -48,6 +48,7 @@ import ( "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_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" @@ -140,6 +141,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) @@ -270,6 +272,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 @@ -334,6 +338,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/virtual_serial_number.go b/power/models/virtual_serial_number.go new file mode 100644 index 00000000..51f35b38 --- /dev/null +++ b/power/models/virtual_serial_number.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// VirtualSerialNumber VSN Details +// +// swagger:model VirtualSerialNumber +type VirtualSerialNumber struct { + + // Description of the retained VSN + Description string `json:"description,omitempty"` + + // HostID of the retained VSN + Host string `json:"host,omitempty"` + + // ID of the retained VSN + VirtualSerialNumber string `json:"virtual-serial-number,omitempty"` +} + +// Validate validates this virtual serial number +func (m *VirtualSerialNumber) Validate(formats strfmt.Registry) error { + 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..0ef19e24 --- /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 An array of retained VSNs +// +// 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 +} From d0b68a7fb0fdd0da9c24fa5061f24620f0d37253 Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Thu, 8 Aug 2024 08:26:22 -0500 Subject: [PATCH 060/123] Fix typo in file name (#442) --- ...i-network-address-group.go => ibm-pi-network-address-group.go} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename clients/instance/{ibmi-pi-network-address-group.go => ibm-pi-network-address-group.go} (100%) diff --git a/clients/instance/ibmi-pi-network-address-group.go b/clients/instance/ibm-pi-network-address-group.go similarity index 100% rename from clients/instance/ibmi-pi-network-address-group.go rename to clients/instance/ibm-pi-network-address-group.go From 2ea33612b96d78aacb5cabc68af095e594ea2abe Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Thu, 8 Aug 2024 08:28:03 -0500 Subject: [PATCH 061/123] Generated Swagger client from service-broker commit dcdebb6b0053044d882d02b44116455004075bf5 (#440) --- power/models/p_vm_instance.go | 3 +++ power/models/p_vm_instance_create.go | 3 +++ power/models/p_vm_instance_update.go | 3 +++ 3 files changed, 9 insertions(+) diff --git a/power/models/p_vm_instance.go b/power/models/p_vm_instance.go index 457affd7..31e49515 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"` + // VSN id allocated to the Virtual Machine + VirtualSerialNumber string `json:"virtualSerialNumber,omitempty"` + // List of volume IDs // Required: true VolumeIDs []string `json:"volumeIDs"` diff --git a/power/models/p_vm_instance_create.go b/power/models/p_vm_instance_create.go index a44538bb..3ad1d277 100644 --- a/power/models/p_vm_instance_create.go +++ b/power/models/p_vm_instance_create.go @@ -124,6 +124,9 @@ type PVMInstanceCreate struct { // The pvm instance virtual CPU information VirtualCores *VirtualCores `json:"virtualCores,omitempty"` + // VSN ID of a retained VSN or specify 'auto-assign' to have a new VSN ID generated. + VirtualSerialNumber string `json:"virtualSerialNumber,omitempty"` + // List of volume IDs VolumeIDs []string `json:"volumeIDs"` } diff --git a/power/models/p_vm_instance_update.go b/power/models/p_vm_instance_update.go index 56e06295..232b2c70 100644 --- a/power/models/p_vm_instance_update.go +++ b/power/models/p_vm_instance_update.go @@ -56,6 +56,9 @@ type PVMInstanceUpdate struct { // The pvm instance virtual CPU information VirtualCores *VirtualCores `json:"virtualCores,omitempty"` + + // VSN ID of a retained VSN or specify 'auto-assign' to have a new VSN ID generated. + VirtualSerialNumber string `json:"virtualSerialNumber,omitempty"` } // Validate validates this p VM instance update From affe2a48a9852f1bede797819769fbbc20b9b431 Mon Sep 17 00:00:00 2001 From: ismirlia <90468712+ismirlia@users.noreply.github.com> Date: Thu, 8 Aug 2024 08:43:20 -0500 Subject: [PATCH 062/123] Revert "Block gateway network update for stratos (#429)" (#441) This reverts commit 4710183925ba7616f1e058ba5af764ccab03da0d. --- clients/instance/ibm-pi-network.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/clients/instance/ibm-pi-network.go b/clients/instance/ibm-pi-network.go index 28ec4be0..a813bc42 100644 --- a/clients/instance/ibm-pi-network.go +++ b/clients/instance/ibm-pi-network.go @@ -79,10 +79,6 @@ func (f *IBMPINetworkClient) Create(body *models.NetworkCreate) (*models.Network // Update a Network func (f *IBMPINetworkClient) Update(id string, body *models.NetworkUpdate) (*models.Network, error) { - // Check for satellite differences in this endpoint - if f.session.IsOnPrem() && body.Gateway != nil { - return nil, fmt.Errorf("gateway parameter is not supported in satellite location, check documentation") - } params := p_cloud_networks.NewPcloudNetworksPutParams(). WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithNetworkID(id). From cf7659c7b5b2761f7ae6a1c34271988e286369ae Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Thu, 15 Aug 2024 16:43:31 -0500 Subject: [PATCH 063/123] Update NSG[rm direction], NI[ch PvmInstance ->Instance, rm NetworkSecurityGroupID](#445) --- power/models/network_security_group_rule.go | 52 --------------------- 1 file changed, 52 deletions(-) diff --git a/power/models/network_security_group_rule.go b/power/models/network_security_group_rule.go index 00c26042..58901232 100644 --- a/power/models/network_security_group_rule.go +++ b/power/models/network_security_group_rule.go @@ -28,11 +28,6 @@ type NetworkSecurityGroupRule struct { // destination port DestinationPort *NetworkSecurityGroupRulePort `json:"destinationPort,omitempty"` - // The direction of the network traffic - // Required: true - // Enum: ["inbound","outbound"] - Direction *string `json:"direction"` - // The ID of the rule in a Network Security Group // Required: true ID *string `json:"id"` @@ -65,10 +60,6 @@ func (m *NetworkSecurityGroupRule) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateDirection(formats); err != nil { - res = append(res, err) - } - if err := m.validateID(formats); err != nil { res = append(res, err) } @@ -157,49 +148,6 @@ func (m *NetworkSecurityGroupRule) validateDestinationPort(formats strfmt.Regist return nil } -var networkSecurityGroupRuleTypeDirectionPropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["inbound","outbound"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - networkSecurityGroupRuleTypeDirectionPropEnum = append(networkSecurityGroupRuleTypeDirectionPropEnum, v) - } -} - -const ( - - // NetworkSecurityGroupRuleDirectionInbound captures enum value "inbound" - NetworkSecurityGroupRuleDirectionInbound string = "inbound" - - // NetworkSecurityGroupRuleDirectionOutbound captures enum value "outbound" - NetworkSecurityGroupRuleDirectionOutbound string = "outbound" -) - -// prop value enum -func (m *NetworkSecurityGroupRule) validateDirectionEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, networkSecurityGroupRuleTypeDirectionPropEnum, true); err != nil { - return err - } - return nil -} - -func (m *NetworkSecurityGroupRule) validateDirection(formats strfmt.Registry) error { - - if err := validate.Required("direction", "body", m.Direction); err != nil { - return err - } - - // value enum - if err := m.validateDirectionEnum("direction", "body", *m.Direction); err != nil { - return err - } - - return nil -} - func (m *NetworkSecurityGroupRule) validateID(formats strfmt.Registry) error { if err := validate.Required("id", "body", m.ID); err != nil { From fca60ce55af130a1a3aee45eb181deea92b6a94c Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Fri, 23 Aug 2024 13:01:34 -0500 Subject: [PATCH 064/123] Update [M]NAg,NSG: member, rules; SysPool: CoreIncrement SB commit c78e75aa6d199faa5196e1bac0488071a074b8c9 (#451) --- ...address_groups_members_delete_responses.go | 8 +- ...k_address_groups_members_post_responses.go | 6 +- ...k_security_groups_action_post_responses.go | 76 +++++++++++++++++++ ...ecurity_groups_members_delete_responses.go | 8 +- ..._security_groups_members_post_responses.go | 6 +- ..._security_groups_rules_delete_responses.go | 8 +- ...rk_security_groups_rules_post_responses.go | 6 +- .../network_security_group_rule_port.go | 4 +- 8 files changed, 96 insertions(+), 26 deletions(-) diff --git a/power/client/network_address_groups/v1_network_address_groups_members_delete_responses.go b/power/client/network_address_groups/v1_network_address_groups_members_delete_responses.go index 86199912..6105c1f6 100644 --- a/power/client/network_address_groups/v1_network_address_groups_members_delete_responses.go +++ b/power/client/network_address_groups/v1_network_address_groups_members_delete_responses.go @@ -82,7 +82,7 @@ V1NetworkAddressGroupsMembersDeleteOK describes a response with status code 200, OK */ type V1NetworkAddressGroupsMembersDeleteOK struct { - Payload *models.NetworkAddressGroup + Payload models.Object } // IsSuccess returns true when this v1 network address groups members delete o k response has a 2xx status code @@ -125,16 +125,14 @@ func (o *V1NetworkAddressGroupsMembersDeleteOK) String() string { return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteOK %s", 200, payload) } -func (o *V1NetworkAddressGroupsMembersDeleteOK) GetPayload() *models.NetworkAddressGroup { +func (o *V1NetworkAddressGroupsMembersDeleteOK) GetPayload() models.Object { return o.Payload } func (o *V1NetworkAddressGroupsMembersDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(models.NetworkAddressGroup) - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { return err } diff --git a/power/client/network_address_groups/v1_network_address_groups_members_post_responses.go b/power/client/network_address_groups/v1_network_address_groups_members_post_responses.go index 76f6e5e0..ea8d2ce3 100644 --- a/power/client/network_address_groups/v1_network_address_groups_members_post_responses.go +++ b/power/client/network_address_groups/v1_network_address_groups_members_post_responses.go @@ -88,7 +88,7 @@ V1NetworkAddressGroupsMembersPostOK describes a response with status code 200, w OK */ type V1NetworkAddressGroupsMembersPostOK struct { - Payload *models.NetworkAddressGroup + Payload *models.NetworkAddressGroupMember } // IsSuccess returns true when this v1 network address groups members post o k response has a 2xx status code @@ -131,13 +131,13 @@ func (o *V1NetworkAddressGroupsMembersPostOK) String() string { return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostOK %s", 200, payload) } -func (o *V1NetworkAddressGroupsMembersPostOK) GetPayload() *models.NetworkAddressGroup { +func (o *V1NetworkAddressGroupsMembersPostOK) GetPayload() *models.NetworkAddressGroupMember { return o.Payload } func (o *V1NetworkAddressGroupsMembersPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(models.NetworkAddressGroup) + o.Payload = new(models.NetworkAddressGroupMember) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { diff --git a/power/client/network_security_groups/v1_network_security_groups_action_post_responses.go b/power/client/network_security_groups/v1_network_security_groups_action_post_responses.go index 2baaa04e..b1536f9f 100644 --- a/power/client/network_security_groups/v1_network_security_groups_action_post_responses.go +++ b/power/client/network_security_groups/v1_network_security_groups_action_post_responses.go @@ -72,6 +72,12 @@ func (o *V1NetworkSecurityGroupsActionPostReader) ReadResponse(response runtime. return nil, err } return nil, result + case 550: + result := NewV1NetworkSecurityGroupsActionPostStatus550() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result default: return nil, runtime.NewAPIError("[POST /v1/network-security-groups/action] v1.networkSecurityGroups.action.post", response, response.Code()) } @@ -632,3 +638,73 @@ func (o *V1NetworkSecurityGroupsActionPostInternalServerError) readResponse(resp return nil } + +// NewV1NetworkSecurityGroupsActionPostStatus550 creates a V1NetworkSecurityGroupsActionPostStatus550 with default headers values +func NewV1NetworkSecurityGroupsActionPostStatus550() *V1NetworkSecurityGroupsActionPostStatus550 { + return &V1NetworkSecurityGroupsActionPostStatus550{} +} + +/* +V1NetworkSecurityGroupsActionPostStatus550 describes a response with status code 550, with default header values. + +Workspace Status Error +*/ +type V1NetworkSecurityGroupsActionPostStatus550 struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups action post status550 response has a 2xx status code +func (o *V1NetworkSecurityGroupsActionPostStatus550) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups action post status550 response has a 3xx status code +func (o *V1NetworkSecurityGroupsActionPostStatus550) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups action post status550 response has a 4xx status code +func (o *V1NetworkSecurityGroupsActionPostStatus550) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups action post status550 response has a 5xx status code +func (o *V1NetworkSecurityGroupsActionPostStatus550) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups action post status550 response a status code equal to that given +func (o *V1NetworkSecurityGroupsActionPostStatus550) IsCode(code int) bool { + return code == 550 +} + +// Code gets the status code for the v1 network security groups action post status550 response +func (o *V1NetworkSecurityGroupsActionPostStatus550) Code() int { + return 550 +} + +func (o *V1NetworkSecurityGroupsActionPostStatus550) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostStatus550 %s", 550, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostStatus550) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostStatus550 %s", 550, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostStatus550) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsActionPostStatus550) 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/network_security_groups/v1_network_security_groups_members_delete_responses.go b/power/client/network_security_groups/v1_network_security_groups_members_delete_responses.go index 8d5336ab..da71f1b2 100644 --- a/power/client/network_security_groups/v1_network_security_groups_members_delete_responses.go +++ b/power/client/network_security_groups/v1_network_security_groups_members_delete_responses.go @@ -82,7 +82,7 @@ V1NetworkSecurityGroupsMembersDeleteOK describes a response with status code 200 OK */ type V1NetworkSecurityGroupsMembersDeleteOK struct { - Payload *models.NetworkSecurityGroup + Payload models.Object } // IsSuccess returns true when this v1 network security groups members delete o k response has a 2xx status code @@ -125,16 +125,14 @@ func (o *V1NetworkSecurityGroupsMembersDeleteOK) String() string { return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteOK %s", 200, payload) } -func (o *V1NetworkSecurityGroupsMembersDeleteOK) GetPayload() *models.NetworkSecurityGroup { +func (o *V1NetworkSecurityGroupsMembersDeleteOK) GetPayload() models.Object { return o.Payload } func (o *V1NetworkSecurityGroupsMembersDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(models.NetworkSecurityGroup) - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { return err } diff --git a/power/client/network_security_groups/v1_network_security_groups_members_post_responses.go b/power/client/network_security_groups/v1_network_security_groups_members_post_responses.go index 41faba80..c273addc 100644 --- a/power/client/network_security_groups/v1_network_security_groups_members_post_responses.go +++ b/power/client/network_security_groups/v1_network_security_groups_members_post_responses.go @@ -88,7 +88,7 @@ V1NetworkSecurityGroupsMembersPostOK describes a response with status code 200, OK */ type V1NetworkSecurityGroupsMembersPostOK struct { - Payload *models.NetworkSecurityGroup + Payload *models.NetworkSecurityGroupMember } // IsSuccess returns true when this v1 network security groups members post o k response has a 2xx status code @@ -131,13 +131,13 @@ func (o *V1NetworkSecurityGroupsMembersPostOK) String() string { return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostOK %s", 200, payload) } -func (o *V1NetworkSecurityGroupsMembersPostOK) GetPayload() *models.NetworkSecurityGroup { +func (o *V1NetworkSecurityGroupsMembersPostOK) GetPayload() *models.NetworkSecurityGroupMember { return o.Payload } func (o *V1NetworkSecurityGroupsMembersPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(models.NetworkSecurityGroup) + o.Payload = new(models.NetworkSecurityGroupMember) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { diff --git a/power/client/network_security_groups/v1_network_security_groups_rules_delete_responses.go b/power/client/network_security_groups/v1_network_security_groups_rules_delete_responses.go index d7aec462..e318eb64 100644 --- a/power/client/network_security_groups/v1_network_security_groups_rules_delete_responses.go +++ b/power/client/network_security_groups/v1_network_security_groups_rules_delete_responses.go @@ -82,7 +82,7 @@ V1NetworkSecurityGroupsRulesDeleteOK describes a response with status code 200, OK */ type V1NetworkSecurityGroupsRulesDeleteOK struct { - Payload *models.NetworkSecurityGroup + Payload models.Object } // IsSuccess returns true when this v1 network security groups rules delete o k response has a 2xx status code @@ -125,16 +125,14 @@ func (o *V1NetworkSecurityGroupsRulesDeleteOK) String() string { return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteOK %s", 200, payload) } -func (o *V1NetworkSecurityGroupsRulesDeleteOK) GetPayload() *models.NetworkSecurityGroup { +func (o *V1NetworkSecurityGroupsRulesDeleteOK) GetPayload() models.Object { return o.Payload } func (o *V1NetworkSecurityGroupsRulesDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(models.NetworkSecurityGroup) - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { return err } diff --git a/power/client/network_security_groups/v1_network_security_groups_rules_post_responses.go b/power/client/network_security_groups/v1_network_security_groups_rules_post_responses.go index 27ae7369..5d519da4 100644 --- a/power/client/network_security_groups/v1_network_security_groups_rules_post_responses.go +++ b/power/client/network_security_groups/v1_network_security_groups_rules_post_responses.go @@ -88,7 +88,7 @@ V1NetworkSecurityGroupsRulesPostOK describes a response with status code 200, wi OK */ type V1NetworkSecurityGroupsRulesPostOK struct { - Payload *models.NetworkSecurityGroup + Payload *models.NetworkSecurityGroupRule } // IsSuccess returns true when this v1 network security groups rules post o k response has a 2xx status code @@ -131,13 +131,13 @@ func (o *V1NetworkSecurityGroupsRulesPostOK) String() string { return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostOK %s", 200, payload) } -func (o *V1NetworkSecurityGroupsRulesPostOK) GetPayload() *models.NetworkSecurityGroup { +func (o *V1NetworkSecurityGroupsRulesPostOK) GetPayload() *models.NetworkSecurityGroupRule { return o.Payload } func (o *V1NetworkSecurityGroupsRulesPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(models.NetworkSecurityGroup) + o.Payload = new(models.NetworkSecurityGroupRule) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { diff --git a/power/models/network_security_group_rule_port.go b/power/models/network_security_group_rule_port.go index 9038f803..bb8cc5f5 100644 --- a/power/models/network_security_group_rule_port.go +++ b/power/models/network_security_group_rule_port.go @@ -18,10 +18,10 @@ import ( type NetworkSecurityGroupRulePort struct { // The end of the port range, if applicable, If values are not present then all ports are in the range - Maximum float64 `json:"maximum,omitempty"` + Maximum int64 `json:"maximum,omitempty"` // The start of the port range, if applicable. If values are not present then all ports are in the range - Minimum float64 `json:"minimum,omitempty"` + Minimum int64 `json:"minimum,omitempty"` } // Validate validates this network security group rule port From a422e723cc52ddc6b094563768fb18315ce3a3c5 Mon Sep 17 00:00:00 2001 From: Alexander-Kita Date: Mon, 26 Aug 2024 08:56:45 -0500 Subject: [PATCH 065/123] Update NSG and NAG types (#452) * Change NSG and NAG response types * Fix deletes --- .../instance/ibm-pi-network-address-group.go | 13 ++++------ .../instance/ibm-pi-network-security-group.go | 26 +++++++------------ 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/clients/instance/ibm-pi-network-address-group.go b/clients/instance/ibm-pi-network-address-group.go index 16695a20..0d42788c 100644 --- a/clients/instance/ibm-pi-network-address-group.go +++ b/clients/instance/ibm-pi-network-address-group.go @@ -90,7 +90,7 @@ func (f *IBMPINetworkAddressGroupClient) Delete(id string) error { } // Add a member to a Network Address Group -func (f *IBMPINetworkAddressGroupClient) AddMember(id string, body *models.NetworkAddressGroupAddMember) (*models.NetworkAddressGroup, error) { +func (f *IBMPINetworkAddressGroupClient) AddMember(id string, body *models.NetworkAddressGroupAddMember) (*models.NetworkAddressGroupMember, error) { params := network_address_groups.NewV1NetworkAddressGroupsMembersPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithNetworkAddressGroupID(id) resp, err := f.session.Power.NetworkAddressGroups.V1NetworkAddressGroupsMembersPost(params, f.session.AuthInfo(f.cloudInstanceID)) if err != nil { @@ -103,15 +103,12 @@ func (f *IBMPINetworkAddressGroupClient) AddMember(id string, body *models.Netwo } // Delete the member from a Network Address Group -func (f *IBMPINetworkAddressGroupClient) DeleteMember(id, memberId string) (*models.NetworkAddressGroup, error) { +func (f *IBMPINetworkAddressGroupClient) DeleteMember(id, memberId string) error { params := network_address_groups.NewV1NetworkAddressGroupsMembersDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut).WithNetworkAddressGroupID(id).WithNetworkAddressGroupMemberID(memberId) - resp, err := f.session.Power.NetworkAddressGroups.V1NetworkAddressGroupsMembersDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + _, err := f.session.Power.NetworkAddressGroups.V1NetworkAddressGroupsMembersDelete(params, f.session.AuthInfo(f.cloudInstanceID)) if err != nil { - return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to delete member %s from network address group %s: %w", memberId, id, err)) + return ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to delete member %s from network address group %s: %w", memberId, id, err)) } - if resp == nil || resp.Payload == nil { - return nil, fmt.Errorf("failed to delete member %s from network address group %s", memberId, id) - } - return resp.Payload, nil + return nil } diff --git a/clients/instance/ibm-pi-network-security-group.go b/clients/instance/ibm-pi-network-security-group.go index e5ba9ce4..d9d4bf52 100644 --- a/clients/instance/ibm-pi-network-security-group.go +++ b/clients/instance/ibm-pi-network-security-group.go @@ -88,7 +88,7 @@ func (f *IBMPINetworkSecurityGroupClient) Delete(id string) error { } // Add a member to a network security group -func (f *IBMPINetworkSecurityGroupClient) AddMember(id string, body *models.NetworkSecurityGroupAddMember) (*models.NetworkSecurityGroup, error) { +func (f *IBMPINetworkSecurityGroupClient) AddMember(id string, body *models.NetworkSecurityGroupAddMember) (*models.NetworkSecurityGroupMember, error) { params := network_security_groups.NewV1NetworkSecurityGroupsMembersPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithNetworkSecurityGroupID(id).WithBody(body) resp, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsMembersPost(params, f.session.AuthInfo(f.cloudInstanceID)) if err != nil { @@ -101,20 +101,17 @@ func (f *IBMPINetworkSecurityGroupClient) AddMember(id string, body *models.Netw } // Deleta a member from a network securti group -func (f *IBMPINetworkSecurityGroupClient) DeleteMember(id, memberId string) (*models.NetworkSecurityGroup, error) { +func (f *IBMPINetworkSecurityGroupClient) DeleteMember(id, memberId string) error { params := network_security_groups.NewV1NetworkSecurityGroupsMembersDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut).WithNetworkSecurityGroupID(id).WithNetworkSecurityGroupMemberID(memberId) - resp, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsMembersDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + _, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsMembersDelete(params, f.session.AuthInfo(f.cloudInstanceID)) if err != nil { - return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to delete member %s from network security group %s: %w", memberId, id, err)) + return ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to delete member %s from network security group %s: %w", memberId, id, err)) } - if resp == nil || resp.Payload == nil { - return nil, fmt.Errorf("failed to delete member %s from network security group %s", memberId, id) - } - return resp.Payload, nil + return nil } // Add a rule to a network security group -func (f *IBMPINetworkSecurityGroupClient) AddRule(id string, body *models.NetworkSecurityGroupAddRule) (*models.NetworkSecurityGroup, error) { +func (f *IBMPINetworkSecurityGroupClient) AddRule(id string, body *models.NetworkSecurityGroupAddRule) (*models.NetworkSecurityGroupRule, error) { params := network_security_groups.NewV1NetworkSecurityGroupsRulesPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithNetworkSecurityGroupID(id).WithBody(body) resp, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsRulesPost(params, f.session.AuthInfo(f.cloudInstanceID)) if err != nil { @@ -127,16 +124,13 @@ func (f *IBMPINetworkSecurityGroupClient) AddRule(id string, body *models.Networ } // Delete a rule from a network security group -func (f *IBMPINetworkSecurityGroupClient) DeleteRule(id, ruleId string) (*models.NetworkSecurityGroup, error) { +func (f *IBMPINetworkSecurityGroupClient) DeleteRule(id, ruleId string) error { params := network_security_groups.NewV1NetworkSecurityGroupsRulesDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut).WithNetworkSecurityGroupID(id).WithNetworkSecurityGroupRuleID(ruleId) - resp, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsRulesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + _, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsRulesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) if err != nil { - return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to delete rule %s from network security group %s: %w", ruleId, id, err)) + return ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to delete rule %s from network security group %s: %w", ruleId, id, err)) } - if resp == nil || resp.Payload == nil { - return nil, fmt.Errorf("failed to delete rule %s from network security group %s", ruleId, id) - } - return resp.Payload, nil + return nil } // Action on a network security group From 270913e02b2621bb691b63caf7a40c2e008d9e30 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Tue, 27 Aug 2024 10:13:43 -0500 Subject: [PATCH 066/123] [M] NetworkSecurityGroupRuleProtocol: IcmpTypes float64-> int64 SB commit 8052ef5f496669f885519678a3e9fe6fe638cf5d (#454) --- power/models/network_security_group_rule_protocol.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/power/models/network_security_group_rule_protocol.go b/power/models/network_security_group_rule_protocol.go index e76368cc..f55e1272 100644 --- a/power/models/network_security_group_rule_protocol.go +++ b/power/models/network_security_group_rule_protocol.go @@ -22,7 +22,7 @@ import ( type NetworkSecurityGroupRuleProtocol struct { // If icmp type, the list of ICMP packet types (by numbers) affected by ICMP rules and if not present then all types are matched - IcmpTypes []float64 `json:"icmpTypes"` + IcmpTypes []int64 `json:"icmpTypes"` // If tcp type, the list of TCP flags and if not present then all flags are matched TCPFlags []*NetworkSecurityGroupRuleProtocolTCPFlag `json:"tcpFlags"` From 372039279fbc82921ba8431896b5d0dff93f3f12 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Wed, 28 Aug 2024 16:03:27 -0500 Subject: [PATCH 067/123] [M] NetworkSecurityGroupRulePort: min and max limit, NSG Rule: rm Direction and Name SB commit 4a6fb79d2076748aedcfcfa65b727fc413e8a7df (#455) --- .../models/network_security_group_add_rule.go | 69 ------------------- power/models/network_security_group_rule.go | 17 ----- .../network_security_group_rule_port.go | 45 +++++++++++- 3 files changed, 43 insertions(+), 88 deletions(-) diff --git a/power/models/network_security_group_add_rule.go b/power/models/network_security_group_add_rule.go index 69b9bcd4..2d4037c8 100644 --- a/power/models/network_security_group_add_rule.go +++ b/power/models/network_security_group_add_rule.go @@ -28,15 +28,6 @@ type NetworkSecurityGroupAddRule struct { // destination ports DestinationPorts *NetworkSecurityGroupRulePort `json:"destinationPorts,omitempty"` - // The direction of the network traffic - // Required: true - // Enum: ["inbound","outbound"] - Direction *string `json:"direction"` - - // The unique name of the Network Security Group rule - // Required: true - Name *string `json:"name"` - // protocol // Required: true Protocol *NetworkSecurityGroupRuleProtocol `json:"protocol"` @@ -61,14 +52,6 @@ func (m *NetworkSecurityGroupAddRule) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateDirection(formats); err != nil { - res = append(res, err) - } - - if err := m.validateName(formats); err != nil { - res = append(res, err) - } - if err := m.validateProtocol(formats); err != nil { res = append(res, err) } @@ -149,58 +132,6 @@ func (m *NetworkSecurityGroupAddRule) validateDestinationPorts(formats strfmt.Re return nil } -var networkSecurityGroupAddRuleTypeDirectionPropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["inbound","outbound"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - networkSecurityGroupAddRuleTypeDirectionPropEnum = append(networkSecurityGroupAddRuleTypeDirectionPropEnum, v) - } -} - -const ( - - // NetworkSecurityGroupAddRuleDirectionInbound captures enum value "inbound" - NetworkSecurityGroupAddRuleDirectionInbound string = "inbound" - - // NetworkSecurityGroupAddRuleDirectionOutbound captures enum value "outbound" - NetworkSecurityGroupAddRuleDirectionOutbound string = "outbound" -) - -// prop value enum -func (m *NetworkSecurityGroupAddRule) validateDirectionEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, networkSecurityGroupAddRuleTypeDirectionPropEnum, true); err != nil { - return err - } - return nil -} - -func (m *NetworkSecurityGroupAddRule) validateDirection(formats strfmt.Registry) error { - - if err := validate.Required("direction", "body", m.Direction); err != nil { - return err - } - - // value enum - if err := m.validateDirectionEnum("direction", "body", *m.Direction); err != nil { - return err - } - - return nil -} - -func (m *NetworkSecurityGroupAddRule) validateName(formats strfmt.Registry) error { - - if err := validate.Required("name", "body", m.Name); err != nil { - return err - } - - return nil -} - func (m *NetworkSecurityGroupAddRule) validateProtocol(formats strfmt.Registry) error { if err := validate.Required("protocol", "body", m.Protocol); err != nil { diff --git a/power/models/network_security_group_rule.go b/power/models/network_security_group_rule.go index 58901232..a1be84f9 100644 --- a/power/models/network_security_group_rule.go +++ b/power/models/network_security_group_rule.go @@ -32,10 +32,6 @@ type NetworkSecurityGroupRule struct { // Required: true ID *string `json:"id"` - // The unique name of the Network Security Group rule - // Required: true - Name *string `json:"name"` - // protocol // Required: true Protocol *NetworkSecurityGroupRuleProtocol `json:"protocol"` @@ -64,10 +60,6 @@ func (m *NetworkSecurityGroupRule) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateName(formats); err != nil { - res = append(res, err) - } - if err := m.validateProtocol(formats); err != nil { res = append(res, err) } @@ -157,15 +149,6 @@ func (m *NetworkSecurityGroupRule) validateID(formats strfmt.Registry) error { return nil } -func (m *NetworkSecurityGroupRule) validateName(formats strfmt.Registry) error { - - if err := validate.Required("name", "body", m.Name); err != nil { - return err - } - - return nil -} - func (m *NetworkSecurityGroupRule) validateProtocol(formats strfmt.Registry) error { if err := validate.Required("protocol", "body", m.Protocol); err != nil { diff --git a/power/models/network_security_group_rule_port.go b/power/models/network_security_group_rule_port.go index bb8cc5f5..296b98ab 100644 --- a/power/models/network_security_group_rule_port.go +++ b/power/models/network_security_group_rule_port.go @@ -8,8 +8,10 @@ package models import ( "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + "github.com/go-openapi/validate" ) // NetworkSecurityGroupRulePort network security group rule port @@ -17,15 +19,54 @@ import ( // swagger:model NetworkSecurityGroupRulePort type NetworkSecurityGroupRulePort struct { - // The end of the port range, if applicable, If values are not present then all ports are in the range + // The end of the port range, if applicable. If the value is not present then the default value of 65535 will be the maximum port number. + // Maximum: 65535 Maximum int64 `json:"maximum,omitempty"` - // The start of the port range, if applicable. If values are not present then all ports are in the range + // The start of the port range, if applicable. If the value is not present then the default value of 1 will be the minimum port number. + // Minimum: 1 Minimum int64 `json:"minimum,omitempty"` } // Validate validates this network security group rule port func (m *NetworkSecurityGroupRulePort) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMaximum(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMinimum(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroupRulePort) validateMaximum(formats strfmt.Registry) error { + if swag.IsZero(m.Maximum) { // not required + return nil + } + + if err := validate.MaximumInt("maximum", "body", m.Maximum, 65535, false); err != nil { + return err + } + + return nil +} + +func (m *NetworkSecurityGroupRulePort) validateMinimum(formats strfmt.Registry) error { + if swag.IsZero(m.Minimum) { // not required + return nil + } + + if err := validate.MinimumInt("minimum", "body", m.Minimum, 1, false); err != nil { + return err + } + return nil } From beae8f943de20417bdcdd1b9cd359b9cb7862105 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Thu, 5 Sep 2024 14:52:24 -0500 Subject: [PATCH 068/123] Update [M] NAG, NSG: UserTags add omitempty SB commit 6b88f9d59f3ce12ee6b320cfa7b7727243bc661a (#456) Update [M] NAG, NSG: UserTags add omitempty --- power/models/network_address_group.go | 2 +- power/models/network_address_group_create.go | 2 +- power/models/network_security_group.go | 2 +- power/models/network_security_group_create.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/power/models/network_address_group.go b/power/models/network_address_group.go index e14ebff5..6a7d2a9c 100644 --- a/power/models/network_address_group.go +++ b/power/models/network_address_group.go @@ -36,7 +36,7 @@ type NetworkAddressGroup struct { Name *string `json:"name"` // The user tags associated with this resource. - UserTags []string `json:"userTags"` + UserTags []string `json:"userTags,omitempty"` } // Validate validates this network address group diff --git a/power/models/network_address_group_create.go b/power/models/network_address_group_create.go index a41f1880..24a83dfb 100644 --- a/power/models/network_address_group_create.go +++ b/power/models/network_address_group_create.go @@ -24,7 +24,7 @@ type NetworkAddressGroupCreate struct { Name *string `json:"name"` // The user tags associated with this resource. - UserTags []string `json:"userTags"` + UserTags []string `json:"userTags,omitempty"` } // Validate validates this network address group create diff --git a/power/models/network_security_group.go b/power/models/network_security_group.go index d62dc774..7305e141 100644 --- a/power/models/network_security_group.go +++ b/power/models/network_security_group.go @@ -39,7 +39,7 @@ type NetworkSecurityGroup struct { Rules []*NetworkSecurityGroupRule `json:"rules"` // The user tags associated with this resource. - UserTags []string `json:"userTags"` + UserTags []string `json:"userTags,omitempty"` } // Validate validates this network security group diff --git a/power/models/network_security_group_create.go b/power/models/network_security_group_create.go index fc0bd27e..fdafaa42 100644 --- a/power/models/network_security_group_create.go +++ b/power/models/network_security_group_create.go @@ -24,7 +24,7 @@ type NetworkSecurityGroupCreate struct { Name *string `json:"name"` // The user tags associated with this resource. - UserTags []string `json:"userTags"` + UserTags []string `json:"userTags,omitempty"` } // Validate validates this network security group create From 39cc5bfedf729c99d4f8708c3d0a91add3d29731 Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Fri, 6 Sep 2024 08:37:46 -0500 Subject: [PATCH 069/123] Fix NAG Update (#457) --- clients/instance/ibm-pi-network-address-group.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/instance/ibm-pi-network-address-group.go b/clients/instance/ibm-pi-network-address-group.go index 0d42788c..a80fed33 100644 --- a/clients/instance/ibm-pi-network-address-group.go +++ b/clients/instance/ibm-pi-network-address-group.go @@ -68,7 +68,7 @@ func (f *IBMPINetworkAddressGroupClient) Get(id string) (*models.NetworkAddressG // Update a Network Address Group func (f *IBMPINetworkAddressGroupClient) Update(id string, body *models.NetworkAddressGroupUpdate) (*models.NetworkAddressGroup, error) { - params := network_address_groups.NewV1NetworkAddressGroupsIDPutParams().WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut) + params := network_address_groups.NewV1NetworkAddressGroupsIDPutParams().WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut).WithNetworkAddressGroupID(id).WithBody(body) resp, err := f.session.Power.NetworkAddressGroups.V1NetworkAddressGroupsIDPut(params, f.session.AuthInfo(f.cloudInstanceID)) if err != nil { return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to update network address group %s: %w", id, err)) From 64f1057f580eebcc5c97f510171d741c3b770056 Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Fri, 6 Sep 2024 11:10:16 -0500 Subject: [PATCH 070/123] Fix NAG Member Create (#458) --- clients/instance/ibm-pi-network-address-group.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/instance/ibm-pi-network-address-group.go b/clients/instance/ibm-pi-network-address-group.go index a80fed33..d35dd019 100644 --- a/clients/instance/ibm-pi-network-address-group.go +++ b/clients/instance/ibm-pi-network-address-group.go @@ -91,7 +91,7 @@ func (f *IBMPINetworkAddressGroupClient) Delete(id string) error { // Add a member to a Network Address Group func (f *IBMPINetworkAddressGroupClient) AddMember(id string, body *models.NetworkAddressGroupAddMember) (*models.NetworkAddressGroupMember, error) { - params := network_address_groups.NewV1NetworkAddressGroupsMembersPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithNetworkAddressGroupID(id) + params := network_address_groups.NewV1NetworkAddressGroupsMembersPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithNetworkAddressGroupID(id).WithBody(body) resp, err := f.session.Power.NetworkAddressGroups.V1NetworkAddressGroupsMembersPost(params, f.session.AuthInfo(f.cloudInstanceID)) if err != nil { return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to add member to network address group %s: %w", id, err)) From de4d4bacc5d6f954cd4c39df098341ee52b9e259 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Mon, 16 Sep 2024 08:31:38 -0500 Subject: [PATCH 071/123] Generated Swagger client from service-broker commit eb93d29b12a45ca1b2d1830a6c5fae08057733b0 (#463) --- power/models/i_k_e_policy_authentications.go | 28 -- power/models/i_k_e_policy_dh_groups.go | 28 -- power/models/i_k_e_policy_encryptions.go | 28 -- power/models/i_k_e_policy_options.go | 235 -------------- power/models/i_k_e_policy_template.go | 184 ----------- .../models/ip_s_e_c_policy_authentications.go | 28 -- power/models/ip_s_e_c_policy_dh_groups.go | 28 -- power/models/ip_s_e_c_policy_encryptions.go | 28 -- power/models/ip_sec_policy_options.go | 191 ----------- power/models/ip_sec_policy_template.go | 166 ---------- .../network_security_group_rule_protocol.go | 63 +++- power/models/options.go | 108 ------- power/models/p_vm_instance_address.go | 75 ----- power/models/policy_versions.go | 28 -- power/models/storage_tiers.go | 69 ---- power/models/v_p_naa_s_options.go | 304 ------------------ 16 files changed, 61 insertions(+), 1530 deletions(-) delete mode 100644 power/models/i_k_e_policy_authentications.go delete mode 100644 power/models/i_k_e_policy_dh_groups.go delete mode 100644 power/models/i_k_e_policy_encryptions.go delete mode 100644 power/models/i_k_e_policy_options.go delete mode 100644 power/models/i_k_e_policy_template.go delete mode 100644 power/models/ip_s_e_c_policy_authentications.go delete mode 100644 power/models/ip_s_e_c_policy_dh_groups.go delete mode 100644 power/models/ip_s_e_c_policy_encryptions.go delete mode 100644 power/models/ip_sec_policy_options.go delete mode 100644 power/models/ip_sec_policy_template.go delete mode 100644 power/models/options.go delete mode 100644 power/models/p_vm_instance_address.go delete mode 100644 power/models/policy_versions.go delete mode 100644 power/models/storage_tiers.go delete mode 100644 power/models/v_p_naa_s_options.go diff --git a/power/models/i_k_e_policy_authentications.go b/power/models/i_k_e_policy_authentications.go deleted file mode 100644 index 930a3d61..00000000 --- a/power/models/i_k_e_policy_authentications.go +++ /dev/null @@ -1,28 +0,0 @@ -// 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" -) - -// IKEPolicyAuthentications i k e policy authentications -// Example: ["sha-256","sha-384","sha1","none"] -// -// swagger:model IKEPolicyAuthentications -type IKEPolicyAuthentications []string - -// Validate validates this i k e policy authentications -func (m IKEPolicyAuthentications) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this i k e policy authentications based on context it is used -func (m IKEPolicyAuthentications) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} diff --git a/power/models/i_k_e_policy_dh_groups.go b/power/models/i_k_e_policy_dh_groups.go deleted file mode 100644 index a41c32d0..00000000 --- a/power/models/i_k_e_policy_dh_groups.go +++ /dev/null @@ -1,28 +0,0 @@ -// 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" -) - -// IKEPolicyDhGroups i k e policy dh groups -// Example: [1,2,5,14,19,20,24] -// -// swagger:model IKEPolicyDhGroups -type IKEPolicyDhGroups []float64 - -// Validate validates this i k e policy dh groups -func (m IKEPolicyDhGroups) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this i k e policy dh groups based on context it is used -func (m IKEPolicyDhGroups) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} diff --git a/power/models/i_k_e_policy_encryptions.go b/power/models/i_k_e_policy_encryptions.go deleted file mode 100644 index e4642753..00000000 --- a/power/models/i_k_e_policy_encryptions.go +++ /dev/null @@ -1,28 +0,0 @@ -// 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" -) - -// IKEPolicyEncryptions i k e policy encryptions -// Example: ["aes-256-cbc","aes-192-cbc","aes-128-cbc","aes-256-gcm","aes-128-gcm","3des-cbc"] -// -// swagger:model IKEPolicyEncryptions -type IKEPolicyEncryptions []string - -// Validate validates this i k e policy encryptions -func (m IKEPolicyEncryptions) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this i k e policy encryptions based on context it is used -func (m IKEPolicyEncryptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} diff --git a/power/models/i_k_e_policy_options.go b/power/models/i_k_e_policy_options.go deleted file mode 100644 index 20103eec..00000000 --- a/power/models/i_k_e_policy_options.go +++ /dev/null @@ -1,235 +0,0 @@ -// 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" -) - -// IKEPolicyOptions i k e policy options -// -// swagger:model IKEPolicyOptions -type IKEPolicyOptions struct { - - // authentications - // Required: true - Authentications IKEPolicyAuthentications `json:"authentications"` - - // dh groups - // Required: true - DhGroups IKEPolicyDhGroups `json:"dhGroups"` - - // encryptions - // Required: true - Encryptions IKEPolicyEncryptions `json:"encryptions"` - - // versions - // Required: true - Versions PolicyVersions `json:"versions"` -} - -// Validate validates this i k e policy options -func (m *IKEPolicyOptions) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateAuthentications(formats); err != nil { - res = append(res, err) - } - - if err := m.validateDhGroups(formats); err != nil { - res = append(res, err) - } - - if err := m.validateEncryptions(formats); err != nil { - res = append(res, err) - } - - if err := m.validateVersions(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *IKEPolicyOptions) validateAuthentications(formats strfmt.Registry) error { - - if err := validate.Required("authentications", "body", m.Authentications); err != nil { - return err - } - - if err := m.Authentications.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("authentications") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("authentications") - } - return err - } - - return nil -} - -func (m *IKEPolicyOptions) validateDhGroups(formats strfmt.Registry) error { - - if err := validate.Required("dhGroups", "body", m.DhGroups); err != nil { - return err - } - - if err := m.DhGroups.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("dhGroups") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("dhGroups") - } - return err - } - - return nil -} - -func (m *IKEPolicyOptions) validateEncryptions(formats strfmt.Registry) error { - - if err := validate.Required("encryptions", "body", m.Encryptions); err != nil { - return err - } - - if err := m.Encryptions.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("encryptions") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("encryptions") - } - return err - } - - return nil -} - -func (m *IKEPolicyOptions) validateVersions(formats strfmt.Registry) error { - - if err := validate.Required("versions", "body", m.Versions); err != nil { - return err - } - - if err := m.Versions.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("versions") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("versions") - } - return err - } - - return nil -} - -// ContextValidate validate this i k e policy options based on the context it is used -func (m *IKEPolicyOptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateAuthentications(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateDhGroups(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateEncryptions(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateVersions(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *IKEPolicyOptions) contextValidateAuthentications(ctx context.Context, formats strfmt.Registry) error { - - if err := m.Authentications.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("authentications") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("authentications") - } - return err - } - - return nil -} - -func (m *IKEPolicyOptions) contextValidateDhGroups(ctx context.Context, formats strfmt.Registry) error { - - if err := m.DhGroups.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("dhGroups") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("dhGroups") - } - return err - } - - return nil -} - -func (m *IKEPolicyOptions) contextValidateEncryptions(ctx context.Context, formats strfmt.Registry) error { - - if err := m.Encryptions.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("encryptions") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("encryptions") - } - return err - } - - return nil -} - -func (m *IKEPolicyOptions) contextValidateVersions(ctx context.Context, formats strfmt.Registry) error { - - if err := m.Versions.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("versions") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("versions") - } - return err - } - - return nil -} - -// MarshalBinary interface implementation -func (m *IKEPolicyOptions) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *IKEPolicyOptions) UnmarshalBinary(b []byte) error { - var res IKEPolicyOptions - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/power/models/i_k_e_policy_template.go b/power/models/i_k_e_policy_template.go deleted file mode 100644 index afcf73e6..00000000 --- a/power/models/i_k_e_policy_template.go +++ /dev/null @@ -1,184 +0,0 @@ -// 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" -) - -// IKEPolicyTemplate i k e policy template -// -// swagger:model IKEPolicyTemplate -type IKEPolicyTemplate struct { - - // ikePolicy Authentication default value - // Example: sha256 - // Required: true - Authentication *string `json:"authentication"` - - // ikePolicy DHGroup default value - // Example: 2 - // Required: true - DhGroup *int64 `json:"dhGroup"` - - // ikePolicy Encryption default value - // Example: aes-256-cbc - // Required: true - Encryption *string `json:"encryption"` - - // key lifetime - // Required: true - KeyLifetime *KeyLifetime `json:"keyLifetime"` - - // ikePolicy Version default value - // Example: 2 - // Required: true - Version *float64 `json:"version"` -} - -// Validate validates this i k e policy template -func (m *IKEPolicyTemplate) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateAuthentication(formats); err != nil { - res = append(res, err) - } - - if err := m.validateDhGroup(formats); err != nil { - res = append(res, err) - } - - if err := m.validateEncryption(formats); err != nil { - res = append(res, err) - } - - if err := m.validateKeyLifetime(formats); err != nil { - res = append(res, err) - } - - if err := m.validateVersion(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *IKEPolicyTemplate) validateAuthentication(formats strfmt.Registry) error { - - if err := validate.Required("authentication", "body", m.Authentication); err != nil { - return err - } - - return nil -} - -func (m *IKEPolicyTemplate) validateDhGroup(formats strfmt.Registry) error { - - if err := validate.Required("dhGroup", "body", m.DhGroup); err != nil { - return err - } - - return nil -} - -func (m *IKEPolicyTemplate) validateEncryption(formats strfmt.Registry) error { - - if err := validate.Required("encryption", "body", m.Encryption); err != nil { - return err - } - - return nil -} - -func (m *IKEPolicyTemplate) validateKeyLifetime(formats strfmt.Registry) error { - - if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { - return err - } - - if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { - return err - } - - if m.KeyLifetime != nil { - if err := m.KeyLifetime.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keyLifetime") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("keyLifetime") - } - return err - } - } - - return nil -} - -func (m *IKEPolicyTemplate) validateVersion(formats strfmt.Registry) error { - - if err := validate.Required("version", "body", m.Version); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this i k e policy template based on the context it is used -func (m *IKEPolicyTemplate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateKeyLifetime(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *IKEPolicyTemplate) contextValidateKeyLifetime(ctx context.Context, formats strfmt.Registry) error { - - if m.KeyLifetime != nil { - - if err := m.KeyLifetime.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keyLifetime") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("keyLifetime") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *IKEPolicyTemplate) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *IKEPolicyTemplate) UnmarshalBinary(b []byte) error { - var res IKEPolicyTemplate - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/power/models/ip_s_e_c_policy_authentications.go b/power/models/ip_s_e_c_policy_authentications.go deleted file mode 100644 index e7d49a6b..00000000 --- a/power/models/ip_s_e_c_policy_authentications.go +++ /dev/null @@ -1,28 +0,0 @@ -// 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" -) - -// IPSECPolicyAuthentications IP s e c policy authentications -// Example: ["hmac-sha-256-128","hmac-sha1-96","none"] -// -// swagger:model IPSECPolicyAuthentications -type IPSECPolicyAuthentications []string - -// Validate validates this IP s e c policy authentications -func (m IPSECPolicyAuthentications) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this IP s e c policy authentications based on context it is used -func (m IPSECPolicyAuthentications) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} diff --git a/power/models/ip_s_e_c_policy_dh_groups.go b/power/models/ip_s_e_c_policy_dh_groups.go deleted file mode 100644 index 3db313e5..00000000 --- a/power/models/ip_s_e_c_policy_dh_groups.go +++ /dev/null @@ -1,28 +0,0 @@ -// 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" -) - -// IPSECPolicyDhGroups IP s e c policy dh groups -// Example: [1,2,5,14,19,20] -// -// swagger:model IPSECPolicyDhGroups -type IPSECPolicyDhGroups []float64 - -// Validate validates this IP s e c policy dh groups -func (m IPSECPolicyDhGroups) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this IP s e c policy dh groups based on context it is used -func (m IPSECPolicyDhGroups) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} diff --git a/power/models/ip_s_e_c_policy_encryptions.go b/power/models/ip_s_e_c_policy_encryptions.go deleted file mode 100644 index be20e38f..00000000 --- a/power/models/ip_s_e_c_policy_encryptions.go +++ /dev/null @@ -1,28 +0,0 @@ -// 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" -) - -// IPSECPolicyEncryptions IP s e c policy encryptions -// Example: ["aes-256-cbc","aes-192-cbc","aes-128-cbc","aes-256-gcm","aes-128-gcm","3des-cbc"] -// -// swagger:model IPSECPolicyEncryptions -type IPSECPolicyEncryptions []string - -// Validate validates this IP s e c policy encryptions -func (m IPSECPolicyEncryptions) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this IP s e c policy encryptions based on context it is used -func (m IPSECPolicyEncryptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} diff --git a/power/models/ip_sec_policy_options.go b/power/models/ip_sec_policy_options.go deleted file mode 100644 index 07841dff..00000000 --- a/power/models/ip_sec_policy_options.go +++ /dev/null @@ -1,191 +0,0 @@ -// 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" -) - -// IPSecPolicyOptions IP sec policy options -// -// swagger:model IPSecPolicyOptions -type IPSecPolicyOptions struct { - - // authentications - // Required: true - Authentications IPSECPolicyAuthentications `json:"authentications"` - - // dh groups - // Required: true - DhGroups IPSECPolicyDhGroups `json:"dhGroups"` - - // encryptions - // Required: true - Encryptions IPSECPolicyEncryptions `json:"encryptions"` -} - -// Validate validates this IP sec policy options -func (m *IPSecPolicyOptions) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateAuthentications(formats); err != nil { - res = append(res, err) - } - - if err := m.validateDhGroups(formats); err != nil { - res = append(res, err) - } - - if err := m.validateEncryptions(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *IPSecPolicyOptions) validateAuthentications(formats strfmt.Registry) error { - - if err := validate.Required("authentications", "body", m.Authentications); err != nil { - return err - } - - if err := m.Authentications.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("authentications") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("authentications") - } - return err - } - - return nil -} - -func (m *IPSecPolicyOptions) validateDhGroups(formats strfmt.Registry) error { - - if err := validate.Required("dhGroups", "body", m.DhGroups); err != nil { - return err - } - - if err := m.DhGroups.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("dhGroups") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("dhGroups") - } - return err - } - - return nil -} - -func (m *IPSecPolicyOptions) validateEncryptions(formats strfmt.Registry) error { - - if err := validate.Required("encryptions", "body", m.Encryptions); err != nil { - return err - } - - if err := m.Encryptions.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("encryptions") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("encryptions") - } - return err - } - - return nil -} - -// ContextValidate validate this IP sec policy options based on the context it is used -func (m *IPSecPolicyOptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateAuthentications(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateDhGroups(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateEncryptions(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *IPSecPolicyOptions) contextValidateAuthentications(ctx context.Context, formats strfmt.Registry) error { - - if err := m.Authentications.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("authentications") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("authentications") - } - return err - } - - return nil -} - -func (m *IPSecPolicyOptions) contextValidateDhGroups(ctx context.Context, formats strfmt.Registry) error { - - if err := m.DhGroups.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("dhGroups") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("dhGroups") - } - return err - } - - return nil -} - -func (m *IPSecPolicyOptions) contextValidateEncryptions(ctx context.Context, formats strfmt.Registry) error { - - if err := m.Encryptions.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("encryptions") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("encryptions") - } - return err - } - - return nil -} - -// MarshalBinary interface implementation -func (m *IPSecPolicyOptions) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *IPSecPolicyOptions) UnmarshalBinary(b []byte) error { - var res IPSecPolicyOptions - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/power/models/ip_sec_policy_template.go b/power/models/ip_sec_policy_template.go deleted file mode 100644 index e854608c..00000000 --- a/power/models/ip_sec_policy_template.go +++ /dev/null @@ -1,166 +0,0 @@ -// 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" -) - -// IPSecPolicyTemplate IP sec policy template -// -// swagger:model IPSecPolicyTemplate -type IPSecPolicyTemplate struct { - - // ipSecPolicy Authentication default value - // Example: sha256 - // Required: true - Authentication *string `json:"authentication"` - - // ipSecPolicy DHGroup default value - // Example: 2 - // Required: true - DhGroup *int64 `json:"dhGroup"` - - // ipSecPolicy Encryption default value - // Example: aes-256-cbc - // Required: true - Encryption *string `json:"encryption"` - - // key lifetime - // Required: true - KeyLifetime *KeyLifetime `json:"keyLifetime"` -} - -// Validate validates this IP sec policy template -func (m *IPSecPolicyTemplate) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateAuthentication(formats); err != nil { - res = append(res, err) - } - - if err := m.validateDhGroup(formats); err != nil { - res = append(res, err) - } - - if err := m.validateEncryption(formats); err != nil { - res = append(res, err) - } - - if err := m.validateKeyLifetime(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *IPSecPolicyTemplate) validateAuthentication(formats strfmt.Registry) error { - - if err := validate.Required("authentication", "body", m.Authentication); err != nil { - return err - } - - return nil -} - -func (m *IPSecPolicyTemplate) validateDhGroup(formats strfmt.Registry) error { - - if err := validate.Required("dhGroup", "body", m.DhGroup); err != nil { - return err - } - - return nil -} - -func (m *IPSecPolicyTemplate) validateEncryption(formats strfmt.Registry) error { - - if err := validate.Required("encryption", "body", m.Encryption); err != nil { - return err - } - - return nil -} - -func (m *IPSecPolicyTemplate) validateKeyLifetime(formats strfmt.Registry) error { - - if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { - return err - } - - if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { - return err - } - - if m.KeyLifetime != nil { - if err := m.KeyLifetime.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keyLifetime") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("keyLifetime") - } - return err - } - } - - return nil -} - -// ContextValidate validate this IP sec policy template based on the context it is used -func (m *IPSecPolicyTemplate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateKeyLifetime(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *IPSecPolicyTemplate) contextValidateKeyLifetime(ctx context.Context, formats strfmt.Registry) error { - - if m.KeyLifetime != nil { - - if err := m.KeyLifetime.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keyLifetime") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("keyLifetime") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *IPSecPolicyTemplate) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *IPSecPolicyTemplate) UnmarshalBinary(b []byte) error { - var res IPSecPolicyTemplate - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/power/models/network_security_group_rule_protocol.go b/power/models/network_security_group_rule_protocol.go index f55e1272..3cb7cd17 100644 --- a/power/models/network_security_group_rule_protocol.go +++ b/power/models/network_security_group_rule_protocol.go @@ -21,8 +21,9 @@ import ( // swagger:model NetworkSecurityGroupRuleProtocol type NetworkSecurityGroupRuleProtocol struct { - // If icmp type, the list of ICMP packet types (by numbers) affected by ICMP rules and if not present then all types are matched - IcmpTypes []int64 `json:"icmpTypes"` + // If icmp type, a ICMP packet type affected by ICMP rules and if not present then all types are matched + // Enum: ["all","echo","echo-reply","source-quench","time-exceeded","destination-unreach"] + IcmpType *string `json:"icmpType,omitempty"` // If tcp type, the list of TCP flags and if not present then all flags are matched TCPFlags []*NetworkSecurityGroupRuleProtocolTCPFlag `json:"tcpFlags"` @@ -36,6 +37,10 @@ type NetworkSecurityGroupRuleProtocol struct { func (m *NetworkSecurityGroupRuleProtocol) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateIcmpType(formats); err != nil { + res = append(res, err) + } + if err := m.validateTCPFlags(formats); err != nil { res = append(res, err) } @@ -50,6 +55,60 @@ func (m *NetworkSecurityGroupRuleProtocol) Validate(formats strfmt.Registry) err return nil } +var networkSecurityGroupRuleProtocolTypeIcmpTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["all","echo","echo-reply","source-quench","time-exceeded","destination-unreach"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkSecurityGroupRuleProtocolTypeIcmpTypePropEnum = append(networkSecurityGroupRuleProtocolTypeIcmpTypePropEnum, v) + } +} + +const ( + + // NetworkSecurityGroupRuleProtocolIcmpTypeAll captures enum value "all" + NetworkSecurityGroupRuleProtocolIcmpTypeAll string = "all" + + // NetworkSecurityGroupRuleProtocolIcmpTypeEcho captures enum value "echo" + NetworkSecurityGroupRuleProtocolIcmpTypeEcho string = "echo" + + // NetworkSecurityGroupRuleProtocolIcmpTypeEchoDashReply captures enum value "echo-reply" + NetworkSecurityGroupRuleProtocolIcmpTypeEchoDashReply string = "echo-reply" + + // NetworkSecurityGroupRuleProtocolIcmpTypeSourceDashQuench captures enum value "source-quench" + NetworkSecurityGroupRuleProtocolIcmpTypeSourceDashQuench string = "source-quench" + + // NetworkSecurityGroupRuleProtocolIcmpTypeTimeDashExceeded captures enum value "time-exceeded" + NetworkSecurityGroupRuleProtocolIcmpTypeTimeDashExceeded string = "time-exceeded" + + // NetworkSecurityGroupRuleProtocolIcmpTypeDestinationDashUnreach captures enum value "destination-unreach" + NetworkSecurityGroupRuleProtocolIcmpTypeDestinationDashUnreach string = "destination-unreach" +) + +// prop value enum +func (m *NetworkSecurityGroupRuleProtocol) validateIcmpTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkSecurityGroupRuleProtocolTypeIcmpTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *NetworkSecurityGroupRuleProtocol) validateIcmpType(formats strfmt.Registry) error { + if swag.IsZero(m.IcmpType) { // not required + return nil + } + + // value enum + if err := m.validateIcmpTypeEnum("icmpType", "body", *m.IcmpType); err != nil { + return err + } + + return nil +} + func (m *NetworkSecurityGroupRuleProtocol) validateTCPFlags(formats strfmt.Registry) error { if swag.IsZero(m.TCPFlags) { // not required return nil diff --git a/power/models/options.go b/power/models/options.go deleted file mode 100644 index 19f536f0..00000000 --- a/power/models/options.go +++ /dev/null @@ -1,108 +0,0 @@ -// 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" -) - -// Options options -// -// swagger:model Options -type Options struct { - - // vpnaas options - // Required: true - VpnaasOptions *VPNaaSOptions `json:"vpnaasOptions"` -} - -// Validate validates this options -func (m *Options) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateVpnaasOptions(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *Options) validateVpnaasOptions(formats strfmt.Registry) error { - - if err := validate.Required("vpnaasOptions", "body", m.VpnaasOptions); err != nil { - return err - } - - if m.VpnaasOptions != nil { - if err := m.VpnaasOptions.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("vpnaasOptions") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("vpnaasOptions") - } - return err - } - } - - return nil -} - -// ContextValidate validate this options based on the context it is used -func (m *Options) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateVpnaasOptions(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *Options) contextValidateVpnaasOptions(ctx context.Context, formats strfmt.Registry) error { - - if m.VpnaasOptions != nil { - - if err := m.VpnaasOptions.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("vpnaasOptions") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("vpnaasOptions") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *Options) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *Options) UnmarshalBinary(b []byte) error { - var res Options - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/power/models/p_vm_instance_address.go b/power/models/p_vm_instance_address.go deleted file mode 100644 index 48dee66d..00000000 --- a/power/models/p_vm_instance_address.go +++ /dev/null @@ -1,75 +0,0 @@ -// 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" -) - -// PVMInstanceAddress deprecated - replaced by PVMInstanceNetwork -// -// swagger:model PVMInstanceAddress -type PVMInstanceAddress struct { - PVMInstanceNetwork -} - -// UnmarshalJSON unmarshals this object from a JSON structure -func (m *PVMInstanceAddress) UnmarshalJSON(raw []byte) error { - // AO0 - var aO0 PVMInstanceNetwork - if err := swag.ReadJSON(raw, &aO0); err != nil { - return err - } - m.PVMInstanceNetwork = aO0 - - return nil -} - -// MarshalJSON marshals this object to a JSON structure -func (m PVMInstanceAddress) MarshalJSON() ([]byte, error) { - _parts := make([][]byte, 0, 1) - - aO0, err := swag.WriteJSON(m.PVMInstanceNetwork) - if err != nil { - return nil, err - } - _parts = append(_parts, aO0) - return swag.ConcatJSON(_parts...), nil -} - -// Validate validates this p VM instance address -func (m *PVMInstanceAddress) Validate(formats strfmt.Registry) error { - var res []error - - // validation for a type composition with PVMInstanceNetwork - if err := m.PVMInstanceNetwork.Validate(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// ContextValidate validate this p VM instance address based on the context it is used -func (m *PVMInstanceAddress) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - // validation for a type composition with PVMInstanceNetwork - if err := m.PVMInstanceNetwork.ContextValidate(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/power/models/policy_versions.go b/power/models/policy_versions.go deleted file mode 100644 index fa426855..00000000 --- a/power/models/policy_versions.go +++ /dev/null @@ -1,28 +0,0 @@ -// 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" -) - -// PolicyVersions policy versions -// Example: [1,2] -// -// swagger:model PolicyVersions -type PolicyVersions []float64 - -// Validate validates this policy versions -func (m PolicyVersions) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this policy versions based on context it is used -func (m PolicyVersions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} diff --git a/power/models/storage_tiers.go b/power/models/storage_tiers.go deleted file mode 100644 index 7a8a46ec..00000000 --- a/power/models/storage_tiers.go +++ /dev/null @@ -1,69 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// StorageTiers A map of an array of storage tiers supported in a region -// -// swagger:model StorageTiers -type StorageTiers map[string]RegionStorageTiers - -// Validate validates this storage tiers -func (m StorageTiers) Validate(formats strfmt.Registry) error { - var res []error - - for k := range m { - - if err := validate.Required(k, "body", m[k]); err != nil { - return err - } - - if err := m[k].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName(k) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName(k) - } - return err - } - - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// ContextValidate validate this storage tiers based on the context it is used -func (m StorageTiers) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - for k := range m { - - if err := m[k].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName(k) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName(k) - } - return err - } - - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/power/models/v_p_naa_s_options.go b/power/models/v_p_naa_s_options.go deleted file mode 100644 index 220ee9c2..00000000 --- a/power/models/v_p_naa_s_options.go +++ /dev/null @@ -1,304 +0,0 @@ -// 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" -) - -// VPNaaSOptions v p naa s options -// -// swagger:model VPNaaSOptions -type VPNaaSOptions struct { - - // dead peer detection - // Required: true - DeadPeerDetection *DeadPeerDetection `json:"deadPeerDetection"` - - // ike policy options - // Required: true - IkePolicyOptions *IKEPolicyOptions `json:"ikePolicyOptions"` - - // ike policy template - // Required: true - IkePolicyTemplate *IKEPolicyTemplate `json:"ikePolicyTemplate"` - - // ip sec policy options - // Required: true - IPSecPolicyOptions *IPSecPolicyOptions `json:"ipSecPolicyOptions"` - - // ip sec policy template - // Required: true - IPSecPolicyTemplate *IPSecPolicyTemplate `json:"ipSecPolicyTemplate"` -} - -// Validate validates this v p naa s options -func (m *VPNaaSOptions) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateDeadPeerDetection(formats); err != nil { - res = append(res, err) - } - - if err := m.validateIkePolicyOptions(formats); err != nil { - res = append(res, err) - } - - if err := m.validateIkePolicyTemplate(formats); err != nil { - res = append(res, err) - } - - if err := m.validateIPSecPolicyOptions(formats); err != nil { - res = append(res, err) - } - - if err := m.validateIPSecPolicyTemplate(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *VPNaaSOptions) validateDeadPeerDetection(formats strfmt.Registry) error { - - if err := validate.Required("deadPeerDetection", "body", m.DeadPeerDetection); err != nil { - return err - } - - if m.DeadPeerDetection != nil { - if err := m.DeadPeerDetection.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("deadPeerDetection") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("deadPeerDetection") - } - return err - } - } - - return nil -} - -func (m *VPNaaSOptions) validateIkePolicyOptions(formats strfmt.Registry) error { - - if err := validate.Required("ikePolicyOptions", "body", m.IkePolicyOptions); err != nil { - return err - } - - if m.IkePolicyOptions != nil { - if err := m.IkePolicyOptions.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ikePolicyOptions") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ikePolicyOptions") - } - return err - } - } - - return nil -} - -func (m *VPNaaSOptions) validateIkePolicyTemplate(formats strfmt.Registry) error { - - if err := validate.Required("ikePolicyTemplate", "body", m.IkePolicyTemplate); err != nil { - return err - } - - if m.IkePolicyTemplate != nil { - if err := m.IkePolicyTemplate.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ikePolicyTemplate") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ikePolicyTemplate") - } - return err - } - } - - return nil -} - -func (m *VPNaaSOptions) validateIPSecPolicyOptions(formats strfmt.Registry) error { - - if err := validate.Required("ipSecPolicyOptions", "body", m.IPSecPolicyOptions); err != nil { - return err - } - - if m.IPSecPolicyOptions != nil { - if err := m.IPSecPolicyOptions.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ipSecPolicyOptions") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ipSecPolicyOptions") - } - return err - } - } - - return nil -} - -func (m *VPNaaSOptions) validateIPSecPolicyTemplate(formats strfmt.Registry) error { - - if err := validate.Required("ipSecPolicyTemplate", "body", m.IPSecPolicyTemplate); err != nil { - return err - } - - if m.IPSecPolicyTemplate != nil { - if err := m.IPSecPolicyTemplate.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ipSecPolicyTemplate") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ipSecPolicyTemplate") - } - return err - } - } - - return nil -} - -// ContextValidate validate this v p naa s options based on the context it is used -func (m *VPNaaSOptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateDeadPeerDetection(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateIkePolicyOptions(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateIkePolicyTemplate(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateIPSecPolicyOptions(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateIPSecPolicyTemplate(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *VPNaaSOptions) contextValidateDeadPeerDetection(ctx context.Context, formats strfmt.Registry) error { - - if m.DeadPeerDetection != nil { - - if err := m.DeadPeerDetection.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("deadPeerDetection") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("deadPeerDetection") - } - return err - } - } - - return nil -} - -func (m *VPNaaSOptions) contextValidateIkePolicyOptions(ctx context.Context, formats strfmt.Registry) error { - - if m.IkePolicyOptions != nil { - - if err := m.IkePolicyOptions.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ikePolicyOptions") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ikePolicyOptions") - } - return err - } - } - - return nil -} - -func (m *VPNaaSOptions) contextValidateIkePolicyTemplate(ctx context.Context, formats strfmt.Registry) error { - - if m.IkePolicyTemplate != nil { - - if err := m.IkePolicyTemplate.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ikePolicyTemplate") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ikePolicyTemplate") - } - return err - } - } - - return nil -} - -func (m *VPNaaSOptions) contextValidateIPSecPolicyOptions(ctx context.Context, formats strfmt.Registry) error { - - if m.IPSecPolicyOptions != nil { - - if err := m.IPSecPolicyOptions.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ipSecPolicyOptions") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ipSecPolicyOptions") - } - return err - } - } - - return nil -} - -func (m *VPNaaSOptions) contextValidateIPSecPolicyTemplate(ctx context.Context, formats strfmt.Registry) error { - - if m.IPSecPolicyTemplate != nil { - - if err := m.IPSecPolicyTemplate.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ipSecPolicyTemplate") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ipSecPolicyTemplate") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *VPNaaSOptions) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *VPNaaSOptions) UnmarshalBinary(b []byte) error { - var res VPNaaSOptions - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} From bb8cca8f730605d8b334fd6852f07bbead5e0518 Mon Sep 17 00:00:00 2001 From: ismirlia <90468712+ismirlia@users.noreply.github.com> Date: Wed, 25 Sep 2024 16:27:15 -0500 Subject: [PATCH 072/123] Remove stratos safeguards for GRS changes (#467) --- clients/instance/ibm-pi-dr-location.go | 6 ------ clients/instance/ibm-pi-volume-onboarding.go | 9 --------- 2 files changed, 15 deletions(-) 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-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) From eef3e728971942b1b9d1119605c8ee4d9782e3d1 Mon Sep 17 00:00:00 2001 From: ismirlia <90468712+ismirlia@users.noreply.github.com> Date: Thu, 26 Sep 2024 09:02:18 -0500 Subject: [PATCH 073/123] Add deployment-type safeguard for stratos (#465) --- clients/instance/ibm-pi-instance.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/instance/ibm-pi-instance.go b/clients/instance/ibm-pi-instance.go index f676a5b9..30d47c28 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). From 35286e43bc330333b5ee221acdb5b19460fe271d Mon Sep 17 00:00:00 2001 From: ismirlia <90468712+ismirlia@users.noreply.github.com> Date: Thu, 26 Sep 2024 09:02:29 -0500 Subject: [PATCH 074/123] Allow spp-plement-group commands on stratos (#469) --- .../instance/ibm-pi-spp-placement-groups.go | 18 ------------------ 1 file changed, 18 deletions(-) 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). From 41c7bede5d9bc84a4a4f921d894e243182d813b1 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Mon, 30 Sep 2024 12:13:35 -0500 Subject: [PATCH 075/123] Generated Swagger client from service-broker commit 6ca735ef9b45f2e11a5966dca1fce308cfd5f4e1 (#466) --- .../client/datacenters/datacenters_client.go | 82 ++++ .../v1_datacenters_private_get_parameters.go | 151 +++++++ .../v1_datacenters_private_get_responses.go | 410 ++++++++++++++++++ ...1_datacenters_private_getall_parameters.go | 128 ++++++ ...v1_datacenters_private_getall_responses.go | 410 ++++++++++++++++++ 5 files changed, 1181 insertions(+) create mode 100644 power/client/datacenters/v1_datacenters_private_get_parameters.go create mode 100644 power/client/datacenters/v1_datacenters_private_get_responses.go create mode 100644 power/client/datacenters/v1_datacenters_private_getall_parameters.go create mode 100644 power/client/datacenters/v1_datacenters_private_getall_responses.go 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 +} From 15a1994c6ed09b781fde83a204d8376844b3c786 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Mon, 30 Sep 2024 13:16:08 -0500 Subject: [PATCH 076/123] Add Virtual Serial Number[A]: VSN, [M]: PVMInstance SB commit 51e56f446e36a9ceb2726258f5bb0d274ae064c9 (#474) --- .../pcloud_pvminstances_delete_parameters.go | 24 + .../p_cloud_virtual_serial_number_client.go | 59 ++- ...virtual_serial_number_getall_parameters.go | 151 ------ ..._virtual_serial_number_getall_responses.go | 484 ----------------- ...loud_virtualserialnumber_get_parameters.go | 151 ++++++ ...cloud_virtualserialnumber_get_responses.go | 486 ++++++++++++++++++ ...d_virtualserialnumber_getall_parameters.go | 164 ++++++ ...ud_virtualserialnumber_getall_responses.go | 484 +++++++++++++++++ .../create_server_virtual_serial_number.go | 74 +++ .../get_server_virtual_serial_number.go | 88 ++++ power/models/p_vm_instance.go | 52 +- power/models/p_vm_instance_create.go | 52 +- power/models/p_vm_instance_delete.go | 50 ++ power/models/p_vm_instance_reference.go | 51 ++ power/models/p_vm_instance_update.go | 3 - power/models/virtual_serial_number.go | 63 ++- power/models/virtual_serial_number_list.go | 2 +- 17 files changed, 1779 insertions(+), 659 deletions(-) delete mode 100644 power/client/p_cloud_virtual_serial_number/pcloud_cloudinstances_virtual_serial_number_getall_parameters.go delete mode 100644 power/client/p_cloud_virtual_serial_number/pcloud_cloudinstances_virtual_serial_number_getall_responses.go create mode 100644 power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_get_parameters.go create mode 100644 power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_get_responses.go create mode 100644 power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_getall_parameters.go create mode 100644 power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_getall_responses.go create mode 100644 power/models/create_server_virtual_serial_number.go create mode 100644 power/models/get_server_virtual_serial_number.go create mode 100644 power/models/p_vm_instance_delete.go 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 index 3366927f..287ad87d 100644 --- 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 @@ -56,28 +56,69 @@ type ClientOption func(*runtime.ClientOperation) // ClientService is the interface for Client methods type ClientService interface { - PcloudCloudinstancesVirtualSerialNumberGetall(params *PcloudCloudinstancesVirtualSerialNumberGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVirtualSerialNumberGetallOK, error) + PcloudVirtualserialnumberGet(params *PcloudVirtualserialnumberGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVirtualserialnumberGetOK, error) + + PcloudVirtualserialnumberGetall(params *PcloudVirtualserialnumberGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVirtualserialnumberGetallOK, error) SetTransport(transport runtime.ClientTransport) } /* -PcloudCloudinstancesVirtualSerialNumberGetall lists all retained v s ns this cloud instance +PcloudVirtualserialnumberGet gets inforamation for a v s n +*/ +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) PcloudCloudinstancesVirtualSerialNumberGetall(params *PcloudCloudinstancesVirtualSerialNumberGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVirtualSerialNumberGetallOK, error) { +func (a *Client) PcloudVirtualserialnumberGetall(params *PcloudVirtualserialnumberGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVirtualserialnumberGetallOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewPcloudCloudinstancesVirtualSerialNumberGetallParams() + params = NewPcloudVirtualserialnumberGetallParams() } op := &runtime.ClientOperation{ - ID: "pcloud.cloudinstances.virtual-serial-number.getall", + ID: "pcloud.virtualserialnumber.getall", Method: "GET", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/virtual-serial-number", + PathPattern: "/v1/virtual-serial-number", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &PcloudCloudinstancesVirtualSerialNumberGetallReader{formats: a.formats}, + Reader: &PcloudVirtualserialnumberGetallReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -90,13 +131,13 @@ func (a *Client) PcloudCloudinstancesVirtualSerialNumberGetall(params *PcloudClo if err != nil { return nil, err } - success, ok := result.(*PcloudCloudinstancesVirtualSerialNumberGetallOK) + 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.cloudinstances.virtual-serial-number.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + 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) } 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 deleted file mode 100644 index 3f54fca4..00000000 --- a/power/client/p_cloud_virtual_serial_number/pcloud_cloudinstances_virtual_serial_number_getall_parameters.go +++ /dev/null @@ -1,151 +0,0 @@ -// 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 deleted file mode 100644 index 37efbafd..00000000 --- a/power/client/p_cloud_virtual_serial_number/pcloud_cloudinstances_virtual_serial_number_getall_responses.go +++ /dev/null @@ -1,484 +0,0 @@ -// 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_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..ae23884c --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_getall_parameters.go @@ -0,0 +1,164 @@ +// 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/go-openapi/swag" +) + +// 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 *bool + + 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 *bool) *PcloudVirtualserialnumberGetallParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud virtualserialnumber getall params +func (o *PcloudVirtualserialnumberGetallParams) SetPvmInstanceID(pvmInstanceID *bool) { + 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 bool + + if o.PvmInstanceID != nil { + qrPvmInstanceID = *o.PvmInstanceID + } + qPvmInstanceID := swag.FormatBool(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/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/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/p_vm_instance.go b/power/models/p_vm_instance.go index 31e49515..5725b1ec 100644 --- a/power/models/p_vm_instance.go +++ b/power/models/p_vm_instance.go @@ -164,8 +164,8 @@ type PVMInstance struct { // The pvm instance virtual CPU information VirtualCores *VirtualCores `json:"virtualCores,omitempty"` - // VSN id allocated to the Virtual Machine - VirtualSerialNumber string `json:"virtualSerialNumber,omitempty"` + // Information about Virtual Serial Number assigned to the PVM Instance + VirtualSerialNumber *GetServerVirtualSerialNumber `json:"virtualSerialNumber,omitempty"` // List of volume IDs // Required: true @@ -272,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) } @@ -675,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 { @@ -732,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...) } @@ -975,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 3ad1d277..3ffdcb19 100644 --- a/power/models/p_vm_instance_create.go +++ b/power/models/p_vm_instance_create.go @@ -124,8 +124,8 @@ type PVMInstanceCreate struct { // The pvm instance virtual CPU information VirtualCores *VirtualCores `json:"virtualCores,omitempty"` - // VSN ID of a retained VSN or specify 'auto-assign' to have a new VSN ID generated. - VirtualSerialNumber string `json:"virtualSerialNumber,omitempty"` + // Virtual Serial Number information + VirtualSerialNumber *CreateServerVirtualSerialNumber `json:"virtualSerialNumber,omitempty"` // List of volume IDs VolumeIDs []string `json:"volumeIDs"` @@ -199,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...) } @@ -594,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 @@ -626,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...) } @@ -773,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_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_update.go b/power/models/p_vm_instance_update.go index 232b2c70..56e06295 100644 --- a/power/models/p_vm_instance_update.go +++ b/power/models/p_vm_instance_update.go @@ -56,9 +56,6 @@ type PVMInstanceUpdate struct { // The pvm instance virtual CPU information VirtualCores *VirtualCores `json:"virtualCores,omitempty"` - - // VSN ID of a retained VSN or specify 'auto-assign' to have a new VSN ID generated. - VirtualSerialNumber string `json:"virtualSerialNumber,omitempty"` } // Validate validates this p VM instance update diff --git a/power/models/virtual_serial_number.go b/power/models/virtual_serial_number.go index 51f35b38..96c211c5 100644 --- a/power/models/virtual_serial_number.go +++ b/power/models/virtual_serial_number.go @@ -8,27 +8,76 @@ package models import ( "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + "github.com/go-openapi/validate" ) -// VirtualSerialNumber VSN Details +// VirtualSerialNumber virtual serial number // // swagger:model VirtualSerialNumber type VirtualSerialNumber struct { - // Description of the retained VSN - Description string `json:"description,omitempty"` + // Description of the Virtual Serial Number + // Required: true + Description *string `json:"description"` - // HostID of the retained VSN - Host string `json:"host,omitempty"` + // ID of the PVM Instance Virtual Serial Number is attached to. + // Required: true + PvmInstanceID *string `json:"pvmInstanceID"` - // ID of the retained VSN - VirtualSerialNumber string `json:"virtual-serial-number,omitempty"` + // 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 } diff --git a/power/models/virtual_serial_number_list.go b/power/models/virtual_serial_number_list.go index 0ef19e24..a83f8bda 100644 --- a/power/models/virtual_serial_number_list.go +++ b/power/models/virtual_serial_number_list.go @@ -14,7 +14,7 @@ import ( "github.com/go-openapi/swag" ) -// VirtualSerialNumberList An array of retained VSNs +// VirtualSerialNumberList List of all Virtual Serial Numbers // // swagger:model VirtualSerialNumberList type VirtualSerialNumberList []*VirtualSerialNumber From 657068b8539f2fc9238318d8841040c1ae130b32 Mon Sep 17 00:00:00 2001 From: Alexander-Kita Date: Thu, 3 Oct 2024 10:50:21 -0500 Subject: [PATCH 077/123] add private datacenter capabilities to datacenter get and getAll (#480) --- clients/instance/ibm-pi-datacenters.go | 59 +++++++++++++++++++------- 1 file changed, 43 insertions(+), 16 deletions(-) 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 } From f2a0dae463ea88d1c0d4d4a2a360434cb7125509 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Tue, 8 Oct 2024 09:06:35 -0500 Subject: [PATCH 078/123] Update VSN:[A] client, create & delete model, SB commit 206f48ce915678642a646f2ac9e1a13c6a7f8442 (#481) Update VSN:[A] client, create & delete model --- .../p_cloud_virtual_serial_number_client.go | 166 ++++- ...s_virtualserialnumber_delete_parameters.go | 197 ++++++ ...es_virtualserialnumber_delete_responses.go | 560 +++++++++++++++ ...nces_virtualserialnumber_get_parameters.go | 173 +++++ ...ances_virtualserialnumber_get_responses.go | 486 +++++++++++++ ...ces_virtualserialnumber_post_parameters.go | 197 ++++++ ...nces_virtualserialnumber_post_responses.go | 636 ++++++++++++++++++ ...nces_virtualserialnumber_put_parameters.go | 197 ++++++ ...ances_virtualserialnumber_put_responses.go | 562 ++++++++++++++++ ...d_virtualserialnumber_getall_parameters.go | 11 +- .../add_server_virtual_serial_number.go | 74 ++ .../delete_server_virtual_serial_number.go | 50 ++ .../update_server_virtual_serial_number.go | 71 ++ 13 files changed, 3373 insertions(+), 7 deletions(-) create mode 100644 power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_delete_parameters.go create mode 100644 power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_delete_responses.go create mode 100644 power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_get_parameters.go create mode 100644 power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_get_responses.go create mode 100644 power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_post_parameters.go create mode 100644 power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_post_responses.go create mode 100644 power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_put_parameters.go create mode 100644 power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_put_responses.go create mode 100644 power/models/add_server_virtual_serial_number.go create mode 100644 power/models/delete_server_virtual_serial_number.go create mode 100644 power/models/update_server_virtual_serial_number.go 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 index 287ad87d..3d4b9c81 100644 --- 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 @@ -56,6 +56,14 @@ type ClientOption func(*runtime.ClientOperation) // ClientService is the interface for Client methods type ClientService interface { + PcloudPvminstancesVirtualserialnumberDelete(params *PcloudPvminstancesVirtualserialnumberDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVirtualserialnumberDeleteOK, 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) + PcloudVirtualserialnumberGet(params *PcloudVirtualserialnumberGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVirtualserialnumberGetOK, error) PcloudVirtualserialnumberGetall(params *PcloudVirtualserialnumberGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVirtualserialnumberGetallOK, error) @@ -64,7 +72,163 @@ type ClientService interface { } /* -PcloudVirtualserialnumberGet gets inforamation for a v s n +PcloudPvminstancesVirtualserialnumberDelete unassigns virtual serial number from a p VM instance +*/ +func (a *Client) PcloudPvminstancesVirtualserialnumberDelete(params *PcloudPvminstancesVirtualserialnumberDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVirtualserialnumberDeleteOK, 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.(*PcloudPvminstancesVirtualserialnumberDeleteOK) + 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) +} + +/* +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 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..e79fa000 --- /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 200: + result := NewPcloudPvminstancesVirtualserialnumberDeleteOK() + 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()) + } +} + +// NewPcloudPvminstancesVirtualserialnumberDeleteOK creates a PcloudPvminstancesVirtualserialnumberDeleteOK with default headers values +func NewPcloudPvminstancesVirtualserialnumberDeleteOK() *PcloudPvminstancesVirtualserialnumberDeleteOK { + return &PcloudPvminstancesVirtualserialnumberDeleteOK{} +} + +/* +PcloudPvminstancesVirtualserialnumberDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPvminstancesVirtualserialnumberDeleteOK struct { + Payload models.Object +} + +// IsSuccess returns true when this pcloud pvminstances virtualserialnumber delete o k response has a 2xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this pcloud pvminstances virtualserialnumber delete o k response has a 3xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this pcloud pvminstances virtualserialnumber delete o k response has a 4xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this pcloud pvminstances virtualserialnumber delete o k response has a 5xx status code +func (o *PcloudPvminstancesVirtualserialnumberDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this pcloud pvminstances virtualserialnumber delete o k response a status code equal to that given +func (o *PcloudPvminstancesVirtualserialnumberDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the pcloud pvminstances virtualserialnumber delete o k response +func (o *PcloudPvminstancesVirtualserialnumberDeleteOK) Code() int { + return 200 +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteOK) 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] pcloudPvminstancesVirtualserialnumberDeleteOK %s", 200, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteOK) 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] pcloudPvminstancesVirtualserialnumberDeleteOK %s", 200, payload) +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberDeleteOK) 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..358bec30 --- /dev/null +++ b/power/client/p_cloud_virtual_serial_number/pcloud_pvminstances_virtualserialnumber_post_responses.go @@ -0,0 +1,636 @@ +// 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.Object +} + +// 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.Object { + return o.Payload +} + +func (o *PcloudPvminstancesVirtualserialnumberPostAccepted) 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 +} + +// 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_getall_parameters.go b/power/client/p_cloud_virtual_serial_number/pcloud_virtualserialnumber_getall_parameters.go index ae23884c..72e191ad 100644 --- 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 @@ -14,7 +14,6 @@ import ( "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" ) // NewPcloudVirtualserialnumberGetallParams creates a new PcloudVirtualserialnumberGetallParams object, @@ -66,7 +65,7 @@ type PcloudVirtualserialnumberGetallParams struct { PVM Instance ID */ - PvmInstanceID *bool + PvmInstanceID *string timeout time.Duration Context context.Context @@ -122,13 +121,13 @@ func (o *PcloudVirtualserialnumberGetallParams) SetHTTPClient(client *http.Clien } // WithPvmInstanceID adds the pvmInstanceID to the pcloud virtualserialnumber getall params -func (o *PcloudVirtualserialnumberGetallParams) WithPvmInstanceID(pvmInstanceID *bool) *PcloudVirtualserialnumberGetallParams { +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 *bool) { +func (o *PcloudVirtualserialnumberGetallParams) SetPvmInstanceID(pvmInstanceID *string) { o.PvmInstanceID = pvmInstanceID } @@ -143,12 +142,12 @@ func (o *PcloudVirtualserialnumberGetallParams) WriteToRequest(r runtime.ClientR if o.PvmInstanceID != nil { // query param pvmInstanceID - var qrPvmInstanceID bool + var qrPvmInstanceID string if o.PvmInstanceID != nil { qrPvmInstanceID = *o.PvmInstanceID } - qPvmInstanceID := swag.FormatBool(qrPvmInstanceID) + qPvmInstanceID := qrPvmInstanceID if qPvmInstanceID != "" { if err := r.SetQueryParam("pvmInstanceID", qPvmInstanceID); err != nil { 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/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/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 +} From 053f37e728c144d4bd250b7497da52ec75f7fd38 Mon Sep 17 00:00:00 2001 From: Michael-Kadiayi Date: Wed, 9 Oct 2024 10:01:22 -0500 Subject: [PATCH 079/123] Add Virtual Serial Number --- clients/instance/ibm-pi-instance.go | 12 +++++ .../instance/ibm-pi-virtual-serial-number.go | 52 +++++++++++++++++++ power/models/s_a_p_profile.go | 43 --------------- 3 files changed, 64 insertions(+), 43 deletions(-) create mode 100644 clients/instance/ibm-pi-virtual-serial-number.go diff --git a/clients/instance/ibm-pi-instance.go b/clients/instance/ibm-pi-instance.go index 30d47c28..4d51878e 100644 --- a/clients/instance/ibm-pi-instance.go +++ b/clients/instance/ibm-pi-instance.go @@ -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-virtual-serial-number.go b/clients/instance/ibm-pi-virtual-serial-number.go new file mode 100644 index 00000000..6583f29e --- /dev/null +++ b/clients/instance/ibm-pi-virtual-serial-number.go @@ -0,0 +1,52 @@ +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() (models.VirtualSerialNumberList, error) { + params := p_cloud_virtual_serial_number.NewPcloudVirtualserialnumberGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut) + 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 +} diff --git a/power/models/s_a_p_profile.go b/power/models/s_a_p_profile.go index fef54859..86d688a2 100644 --- a/power/models/s_a_p_profile.go +++ b/power/models/s_a_p_profile.go @@ -46,11 +46,6 @@ type SAPProfile struct { // Enum: [4,8] SmtMode int64 `json:"smtMode"` - // Required smt mode for that profile - // Required: true - // Enum: [4 8] - SmtMode *int64 `json:"smtMode"` - // List of supported systems SupportedSystems []string `json:"supportedSystems"` @@ -87,10 +82,6 @@ func (m *SAPProfile) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateSmtMode(formats); err != nil { - res = append(res, err) - } - if err := m.validateType(formats); err != nil { res = append(res, err) } @@ -170,40 +161,6 @@ func (m *SAPProfile) validateSmtMode(formats strfmt.Registry) error { return nil } -var sAPProfileTypeSmtModePropEnum []interface{} - -func init() { - var res []int64 - if err := json.Unmarshal([]byte(`[4,8]`), &res); err != nil { - panic(err) - } - for _, v := range res { - sAPProfileTypeSmtModePropEnum = append(sAPProfileTypeSmtModePropEnum, v) - } -} - -// prop value enum -func (m *SAPProfile) validateSmtModeEnum(path, location string, value int64) error { - if err := validate.EnumCase(path, location, value, sAPProfileTypeSmtModePropEnum, true); err != nil { - return err - } - return nil -} - -func (m *SAPProfile) validateSmtMode(formats strfmt.Registry) error { - - if err := validate.Required("smtMode", "body", m.SmtMode); err != nil { - return err - } - - // value enum - if err := m.validateSmtModeEnum("smtMode", "body", *m.SmtMode); err != nil { - return err - } - - return nil -} - var sAPProfileTypeTypePropEnum []interface{} func init() { From 234f0b14e9f779689d9021fe8a3282e000d1ce10 Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Tue, 18 Jun 2024 13:42:55 -0500 Subject: [PATCH 080/123] Gate ibmi 500 (#414) * Bump github.com/IBM/platform-services-go-sdk from 0.56.4 to 0.57.0 Bumps [github.com/IBM/platform-services-go-sdk](https://github.com/IBM/platform-services-go-sdk) from 0.56.4 to 0.57.0. - [Release notes](https://github.com/IBM/platform-services-go-sdk/releases) - [Changelog](https://github.com/IBM/platform-services-go-sdk/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/platform-services-go-sdk/compare/v0.56.4...v0.57.0) --- updated-dependencies: - dependency-name: github.com/IBM/platform-services-go-sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump github.com/IBM/platform-services-go-sdk from 0.57.0 to 0.58.0 Bumps [github.com/IBM/platform-services-go-sdk](https://github.com/IBM/platform-services-go-sdk) from 0.57.0 to 0.58.0. - [Release notes](https://github.com/IBM/platform-services-go-sdk/releases) - [Changelog](https://github.com/IBM/platform-services-go-sdk/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/platform-services-go-sdk/compare/v0.57.0...v0.58.0) --- updated-dependencies: - dependency-name: github.com/IBM/platform-services-go-sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump github.com/IBM/platform-services-go-sdk from 0.58.0 to 0.59.0 Bumps [github.com/IBM/platform-services-go-sdk](https://github.com/IBM/platform-services-go-sdk) from 0.58.0 to 0.59.0. - [Release notes](https://github.com/IBM/platform-services-go-sdk/releases) - [Changelog](https://github.com/IBM/platform-services-go-sdk/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/platform-services-go-sdk/compare/v0.58.0...v0.59.0) --- updated-dependencies: - dependency-name: github.com/IBM/platform-services-go-sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump github.com/IBM/platform-services-go-sdk from 0.59.0 to 0.59.1 Bumps [github.com/IBM/platform-services-go-sdk](https://github.com/IBM/platform-services-go-sdk) from 0.59.0 to 0.59.1. - [Release notes](https://github.com/IBM/platform-services-go-sdk/releases) - [Changelog](https://github.com/IBM/platform-services-go-sdk/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/platform-services-go-sdk/compare/v0.59.0...v0.59.1) --- updated-dependencies: - dependency-name: github.com/IBM/platform-services-go-sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.4 to 1.9.0. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](https://github.com/stretchr/testify/compare/v1.8.4...v1.9.0) --- updated-dependencies: - dependency-name: github.com/stretchr/testify dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump github.com/IBM/platform-services-go-sdk from 0.59.1 to 0.60.0 Bumps [github.com/IBM/platform-services-go-sdk](https://github.com/IBM/platform-services-go-sdk) from 0.59.1 to 0.60.0. - [Release notes](https://github.com/IBM/platform-services-go-sdk/releases) - [Changelog](https://github.com/IBM/platform-services-go-sdk/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/platform-services-go-sdk/compare/v0.59.1...v0.60.0) --- updated-dependencies: - dependency-name: github.com/IBM/platform-services-go-sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Update to go 1.22 * Gate ibmi 500 update go sum --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- clients/instance/ibm-pi-volume.go | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/clients/instance/ibm-pi-volume.go b/clients/instance/ibm-pi-volume.go index a05849c3..e5a628ba 100644 --- a/clients/instance/ibm-pi-volume.go +++ b/clients/instance/ibm-pi-volume.go @@ -257,34 +257,12 @@ func (f *IBMPIVolumeClient) GetVolumeFlashCopyMappings(id string) (models.FlashC // Bulk volume detach func (f *IBMPIVolumeClient) BulkVolumeDetach(pvmID string, body *models.VolumesDetach) (*models.VolumesDetachmentResponse, error) { - params := p_cloud_volumes.NewPcloudV2PvminstancesVolumesDeleteParams(). - WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut).WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(pvmID). - WithBody(body) - resp, err := f.session.Power.PCloudVolumes.PcloudV2PvminstancesVolumesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) - if err != nil { - return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf(errors.DetachVolumesOperationFailed, pvmID, f.cloudInstanceID, err)) - } - if resp == nil || resp.Payload == nil { - return nil, fmt.Errorf("failed detaching volumes for %s", pvmID) - } - return resp.Payload, nil + return nil, fmt.Errorf("operation not supported") } // Bulk volume delete func (f *IBMPIVolumeClient) BulkVolumeDelete(body *models.VolumesDelete) (*models.VolumesDeleteResponse, error) { - params := p_cloud_volumes.NewPcloudV2VolumesDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). - WithCloudInstanceID(f.cloudInstanceID).WithBody(body) - respOk, respPartial, err := f.session.Power.PCloudVolumes.PcloudV2VolumesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) - if err != nil { - return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf(errors.DeleteVolumeOperationFailed, body.VolumeIDs, err)) - } - if respOk != nil && respOk.Payload != nil { - return respOk.Payload, nil - } - if respPartial != nil && respPartial.Payload != nil { - return respPartial.Payload, nil - } - return nil, fmt.Errorf("failed Deleting volumes : %s", body.VolumeIDs) + return nil, fmt.Errorf("operation not supported") } // Bulk volutme attach From 0e3d3a39bfb83d7e3a65d7c7f2d4e1f4d5ab142d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jun 2024 22:14:09 +0000 Subject: [PATCH 081/123] Bump github.com/hashicorp/go-retryablehttp from 0.7.5 to 0.7.7 Bumps [github.com/hashicorp/go-retryablehttp](https://github.com/hashicorp/go-retryablehttp) from 0.7.5 to 0.7.7. - [Changelog](https://github.com/hashicorp/go-retryablehttp/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashicorp/go-retryablehttp/compare/v0.7.5...v0.7.7) --- updated-dependencies: - dependency-name: github.com/hashicorp/go-retryablehttp dependency-type: indirect ... Signed-off-by: dependabot[bot] --- go.mod | 4 ++-- go.sum | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 017e73ae..5c3ed7b1 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-retryablehttp v0.7.5 // indirect + github.com/hashicorp/go-retryablehttp v0.7.7 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/leodido/go-urn v1.3.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect @@ -45,7 +45,7 @@ require ( go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/crypto v0.21.0 // indirect golang.org/x/net v0.23.0 // indirect - golang.org/x/sys v0.18.0 // indirect + golang.org/x/sys v0.20.0 // indirect golang.org/x/text v0.14.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 0ae0fcce..f5ddf185 100644 --- a/go.sum +++ b/go.sum @@ -9,6 +9,8 @@ github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:W github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= @@ -54,10 +56,10 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= -github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M= -github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU= +github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= @@ -69,6 +71,10 @@ github.com/leodido/go-urn v1.3.0 h1:jX8FDLfW4ThVXctBNZ+3cIWnCSnrACDV73r76dy0aQQ= github.com/leodido/go-urn v1.3.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= @@ -87,7 +93,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= @@ -124,8 +129,8 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= From 62b142594dab7b3159bf928f3ac4372ab7d41a80 Mon Sep 17 00:00:00 2001 From: Kishen V Date: Tue, 20 Aug 2024 21:11:45 +0530 Subject: [PATCH 082/123] Get the supported storage tiers of a cloud instance (#446) Signed-off-by: Kishen V --- clients/instance/ibm-pi-storage-tiers.go | 40 ++++++++++++++++++++++++ errors/errors.go | 7 +++-- 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 clients/instance/ibm-pi-storage-tiers.go diff --git a/clients/instance/ibm-pi-storage-tiers.go b/clients/instance/ibm-pi-storage-tiers.go new file mode 100644 index 00000000..fbb87629 --- /dev/null +++ b/clients/instance/ibm-pi-storage-tiers.go @@ -0,0 +1,40 @@ +package instance + +import ( + "context" + "fmt" + + "github.com/IBM-Cloud/power-go-client/errors" + "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_storage_tiers" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPIStorageTierClient +type IBMPIStorageTierClient struct { + IBMPIClient +} + +// NewIBMPIStorageTierClient +func NewIBMPIStorageTierClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPIStorageTierClient { + return &IBMPIStorageTierClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// Gets all the storage tiers associated to the cloud instance. +func (f *IBMPIStorageTierClient) GetAll() (models.RegionStorageTiers, error) { + params := p_cloud_storage_tiers.NewPcloudCloudinstancesStoragetiersGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID) + resp, err := f.session.Power.PCloudStorageTiers.PcloudCloudinstancesStoragetiersGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf(errors.GetAllStorageTiersOperationFailed, f.cloudInstanceID, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get all storage tiers") + } + return resp.Payload, nil +} diff --git a/errors/errors.go b/errors/errors.go index 3e58eb5b..6c9fcbfe 100644 --- a/errors/errors.go +++ b/errors/errors.go @@ -121,12 +121,15 @@ const DeleteSPPPlacementGroupOperationFailed = "failed to perform Delete Shared const AddMemberSPPPlacementGroupOperationFailed = "failed to perform Add Member Operation for pool %s and shared processor pool placement group %s with error %w" const DeleteMemberSPPPlacementGroupOperationFailed = "failed to perform Delete Member Operation for pool %s and shared processor pool placement group %s with error %w" -// start of workspaces +// start of Workspaces Messages const GetWorkspaceOperationFailed = "failed to perform Get Workspace Operation for id %s with error %w" -// Datacenter +// start of Datacenter Messages const GetDatacenterOperationFailed = "failed to perform Get Datacenter Operation for id %s with error %w" +// start of StorageTier Messages +const GetAllStorageTiersOperationFailed = "failed to perform get all Storage Tiers Operation for id %s with error %w" + // ErrorTarget ... type ErrorTarget struct { Name string From c58a6d8c7942335d37b77a4bbfaf5c329ea310da Mon Sep 17 00:00:00 2001 From: ismirlia <90468712+ismirlia@users.noreply.github.com> Date: Wed, 11 Sep 2024 15:33:55 -0500 Subject: [PATCH 083/123] Reenable bulk-detach and bulk-delete for Q3 (#460) --- clients/instance/ibm-pi-volume.go | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/clients/instance/ibm-pi-volume.go b/clients/instance/ibm-pi-volume.go index e5a628ba..a05849c3 100644 --- a/clients/instance/ibm-pi-volume.go +++ b/clients/instance/ibm-pi-volume.go @@ -257,12 +257,34 @@ func (f *IBMPIVolumeClient) GetVolumeFlashCopyMappings(id string) (models.FlashC // Bulk volume detach func (f *IBMPIVolumeClient) BulkVolumeDetach(pvmID string, body *models.VolumesDetach) (*models.VolumesDetachmentResponse, error) { - return nil, fmt.Errorf("operation not supported") + params := p_cloud_volumes.NewPcloudV2PvminstancesVolumesDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut).WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(pvmID). + WithBody(body) + resp, err := f.session.Power.PCloudVolumes.PcloudV2PvminstancesVolumesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf(errors.DetachVolumesOperationFailed, pvmID, f.cloudInstanceID, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed detaching volumes for %s", pvmID) + } + return resp.Payload, nil } // Bulk volume delete func (f *IBMPIVolumeClient) BulkVolumeDelete(body *models.VolumesDelete) (*models.VolumesDeleteResponse, error) { - return nil, fmt.Errorf("operation not supported") + params := p_cloud_volumes.NewPcloudV2VolumesDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithBody(body) + respOk, respPartial, err := f.session.Power.PCloudVolumes.PcloudV2VolumesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf(errors.DeleteVolumeOperationFailed, body.VolumeIDs, err)) + } + if respOk != nil && respOk.Payload != nil { + return respOk.Payload, nil + } + if respPartial != nil && respPartial.Payload != nil { + return respPartial.Payload, nil + } + return nil, fmt.Errorf("failed Deleting volumes : %s", body.VolumeIDs) } // Bulk volutme attach From fe91ca8b6c337062b181f03c9e054f28ece5b0d8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 13:29:46 -0500 Subject: [PATCH 084/123] Bump github.com/go-openapi/errors from 0.21.0 to 0.22.0 (#355) Bumps [github.com/go-openapi/errors](https://github.com/go-openapi/errors) from 0.21.0 to 0.22.0. - [Commits](https://github.com/go-openapi/errors/compare/v0.21.0...v0.22.0) --- updated-dependencies: - dependency-name: github.com/go-openapi/errors dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 5c3ed7b1..562dd5fb 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/IBM/go-sdk-core/v5 v5.15.3 github.com/IBM/platform-services-go-sdk v0.59.1 github.com/apparentlymart/go-cidr v1.1.0 - github.com/go-openapi/errors v0.21.0 + github.com/go-openapi/errors v0.22.0 github.com/go-openapi/runtime v0.26.0 github.com/go-openapi/strfmt v0.22.0 github.com/go-openapi/swag v0.22.5 diff --git a/go.sum b/go.sum index f5ddf185..1a841551 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-openapi/analysis v0.21.5 h1:3tHfEBh6Ia8eKc4M7khOGjPOAlWKJ10d877Cr9teujI= github.com/go-openapi/analysis v0.21.5/go.mod h1:25YcZosX9Lwz2wBsrFrrsL8bmjjXdlyP6zsr2AMy29M= -github.com/go-openapi/errors v0.21.0 h1:FhChC/duCnfoLj1gZ0BgaBmzhJC2SL/sJr8a2vAobSY= -github.com/go-openapi/errors v0.21.0/go.mod h1:jxNTMUxRCKj65yb/okJGEtahVd7uvWnuWfj53bse4ho= +github.com/go-openapi/errors v0.22.0 h1:c4xY/OLxUBSTiepAg3j/MHuAv5mJhnf53LLMWFB+u/w= +github.com/go-openapi/errors v0.22.0/go.mod h1:J3DmZScxCDufmIMsdOuDHxJbdOGC0xtUynjIx092vXE= github.com/go-openapi/jsonpointer v0.20.1 h1:MkK4VEIEZMj4wT9PmjaUmGflVBr9nvud4Q4UVFbDoBE= github.com/go-openapi/jsonpointer v0.20.1/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= github.com/go-openapi/jsonreference v0.20.3 h1:EjGcjTW8pD1mRis6+w/gmoBdqv5+RbE9B85D1NgDOVQ= From b41f00f14a81c043142356edf31ad84931f522e0 Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Mon, 30 Sep 2024 13:50:04 -0500 Subject: [PATCH 085/123] Revert "Bump github.com/go-openapi/errors from 0.21.0 to 0.22.0 (#355)" (#475) This reverts commit 0ce30af5948875528431f6f35b016d9966b58d7a. --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 562dd5fb..5c3ed7b1 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/IBM/go-sdk-core/v5 v5.15.3 github.com/IBM/platform-services-go-sdk v0.59.1 github.com/apparentlymart/go-cidr v1.1.0 - github.com/go-openapi/errors v0.22.0 + github.com/go-openapi/errors v0.21.0 github.com/go-openapi/runtime v0.26.0 github.com/go-openapi/strfmt v0.22.0 github.com/go-openapi/swag v0.22.5 diff --git a/go.sum b/go.sum index 1a841551..f5ddf185 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-openapi/analysis v0.21.5 h1:3tHfEBh6Ia8eKc4M7khOGjPOAlWKJ10d877Cr9teujI= github.com/go-openapi/analysis v0.21.5/go.mod h1:25YcZosX9Lwz2wBsrFrrsL8bmjjXdlyP6zsr2AMy29M= -github.com/go-openapi/errors v0.22.0 h1:c4xY/OLxUBSTiepAg3j/MHuAv5mJhnf53LLMWFB+u/w= -github.com/go-openapi/errors v0.22.0/go.mod h1:J3DmZScxCDufmIMsdOuDHxJbdOGC0xtUynjIx092vXE= +github.com/go-openapi/errors v0.21.0 h1:FhChC/duCnfoLj1gZ0BgaBmzhJC2SL/sJr8a2vAobSY= +github.com/go-openapi/errors v0.21.0/go.mod h1:jxNTMUxRCKj65yb/okJGEtahVd7uvWnuWfj53bse4ho= github.com/go-openapi/jsonpointer v0.20.1 h1:MkK4VEIEZMj4wT9PmjaUmGflVBr9nvud4Q4UVFbDoBE= github.com/go-openapi/jsonpointer v0.20.1/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= github.com/go-openapi/jsonreference v0.20.3 h1:EjGcjTW8pD1mRis6+w/gmoBdqv5+RbE9B85D1NgDOVQ= From 439d15037d223ec8ed97f52c8259a68e3323f598 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 14:20:45 +0000 Subject: [PATCH 086/123] Bump github.com/IBM/platform-services-go-sdk from 0.59.1 to 0.69.2 (#482) --- go.mod | 14 ++++++------- go.sum | 66 +++++++++++++--------------------------------------------- 2 files changed, 20 insertions(+), 60 deletions(-) diff --git a/go.mod b/go.mod index 5c3ed7b1..e7e8d8cb 100644 --- a/go.mod +++ b/go.mod @@ -3,12 +3,12 @@ module github.com/IBM-Cloud/power-go-client go 1.22.0 require ( - github.com/IBM/go-sdk-core/v5 v5.15.3 - github.com/IBM/platform-services-go-sdk v0.59.1 + github.com/IBM/go-sdk-core/v5 v5.17.5 + github.com/IBM/platform-services-go-sdk v0.69.2 github.com/apparentlymart/go-cidr v1.1.0 github.com/go-openapi/errors v0.21.0 github.com/go-openapi/runtime v0.26.0 - github.com/go-openapi/strfmt v0.22.0 + github.com/go-openapi/strfmt v0.22.1 github.com/go-openapi/swag v0.22.5 github.com/go-openapi/validate v0.22.4 github.com/stretchr/testify v1.8.4 @@ -27,20 +27,18 @@ require ( github.com/go-openapi/spec v0.20.12 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.17.0 // indirect - github.com/google/go-cmp v0.6.0 // indirect + github.com/go-playground/validator/v10 v10.19.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-retryablehttp v0.7.7 // indirect github.com/josharian/intern v1.0.0 // indirect - github.com/leodido/go-urn v1.3.0 // indirect + github.com/leodido/go-urn v1.4.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/oklog/ulid v1.3.1 // indirect - github.com/onsi/gomega v1.29.0 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.mongodb.org/mongo-driver v1.13.1 // indirect + go.mongodb.org/mongo-driver v1.14.0 // indirect go.opentelemetry.io/otel v1.14.0 // indirect go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/crypto v0.21.0 // indirect diff --git a/go.sum b/go.sum index f5ddf185..497be505 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ -github.com/IBM/go-sdk-core/v5 v5.15.3 h1:yBSSYLuQSO9Ip+j3mONsTcymoYQyxarQ6rh3aU9cVt8= -github.com/IBM/go-sdk-core/v5 v5.15.3/go.mod h1:ee+AZaB15yUwZigJdRCwZZ3u7HIvEQzxNUdxVpnJHY8= -github.com/IBM/platform-services-go-sdk v0.59.1 h1:qyXJX1sNgbDDrXb5M9LrjMjCm2w9dkSEtBGAfZJlT0Y= -github.com/IBM/platform-services-go-sdk v0.59.1/go.mod h1:cLKLn9Bd1YcTM/micLQmikjZDDQvRgfhdAHKOeulILg= +github.com/IBM/go-sdk-core/v5 v5.17.5 h1:AjGC7xNee5tgDIjndekBDW5AbypdERHSgib3EZ1KNsA= +github.com/IBM/go-sdk-core/v5 v5.17.5/go.mod h1:KsAAI7eStAWwQa4F96MLy+whYSh39JzNjklZRbN/8ns= +github.com/IBM/platform-services-go-sdk v0.69.2 h1:8XNI8rBZShutuybFN5v8BsWlrdUa1eF0L6nOS+lDXmI= +github.com/IBM/platform-services-go-sdk v0.69.2/go.mod h1:ZP3zUDxR1qRdUqzFdnJOlQN0QpVYol2eOUCv4uk03Jc= github.com/apparentlymart/go-cidr v1.1.0 h1:2mAhrMoF+nhXqxTzSZMUzDHkLjmIHC+Zzn4tdgBZjnU= github.com/apparentlymart/go-cidr v1.1.0/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= @@ -34,8 +34,8 @@ github.com/go-openapi/runtime v0.26.0 h1:HYOFtG00FM1UvqrcxbEJg/SwvDRvYLQKGhw2zaQ github.com/go-openapi/runtime v0.26.0/go.mod h1:QgRGeZwrUcSHdeh4Ka9Glvo0ug1LC5WyE+EV88plZrQ= github.com/go-openapi/spec v0.20.12 h1:cgSLbrsmziAP2iais+Vz7kSazwZ8rsUZd6TUzdDgkVI= github.com/go-openapi/spec v0.20.12/go.mod h1:iSCgnBcwbMW9SfzJb8iYynXvcY6C/QFrI7otzF7xGM4= -github.com/go-openapi/strfmt v0.22.0 h1:Ew9PnEYc246TwrEspvBdDHS4BVKXy/AOVsfqGDgAcaI= -github.com/go-openapi/strfmt v0.22.0/go.mod h1:HzJ9kokGIju3/K6ap8jL+OlGAbjpSv27135Yr9OivU4= +github.com/go-openapi/strfmt v0.22.1 h1:5Ky8cybT4576C6Ffc+8gYji/wRXCo6Ozm8RaWjPI6jc= +github.com/go-openapi/strfmt v0.22.1/go.mod h1:OfVoytIXJasDkkGvkb1Cceb3BPyMOwk1FgmyyEw7NYg= github.com/go-openapi/swag v0.22.5 h1:fVS63IE3M0lsuWRzuom3RLwUMVI2peDH01s6M70ugys= github.com/go-openapi/swag v0.22.5/go.mod h1:Gl91UqO+btAM0plGGxHqJcQZ1ZTy6jbmridBTsDy8A0= github.com/go-openapi/validate v0.22.4 h1:5v3jmMyIPKTR8Lv9syBAIRxG6lY0RqeBPB1LKEijzk8= @@ -46,10 +46,8 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.17.0 h1:SmVVlfAOtlZncTxRuinDPomC2DkXJ4E5T9gDA0AIH74= -github.com/go-playground/validator/v10 v10.17.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/go-playground/validator/v10 v10.19.0 h1:ol+5Fu+cSq9JD7SoSqe04GMI92cbn0+wvQ3bZ8b/AU4= +github.com/go-playground/validator/v10 v10.19.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -62,13 +60,12 @@ github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISH github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= -github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/leodido/go-urn v1.3.0 h1:jX8FDLfW4ThVXctBNZ+3cIWnCSnrACDV73r76dy0aQQ= -github.com/leodido/go-urn v1.3.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= +github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= +github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= @@ -77,15 +74,14 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg= -github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/onsi/gomega v1.31.1 h1:KYppCUK+bUgAZwHOu7EXVBKyQA6ILvOESHkn/tgoqvo= +github.com/onsi/gomega v1.31.1/go.mod h1:y40C95dwAD1Nz36SsEnxvfFe8FFfNxzI5eJ0EYGyAy0= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -96,56 +92,22 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= -github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= -github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.mongodb.org/mongo-driver v1.13.1 h1:YIc7HTYsKndGK4RFzJ3covLz1byri52x0IoMB0Pt/vk= -go.mongodb.org/mongo-driver v1.13.1/go.mod h1:wcDf1JBCXy2mOW0bWHwO/IOYqdca1MPCwDtFu/Z9+eo= +go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80= +go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU= go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvxGzY= go.opentelemetry.io/otel/sdk v1.14.0/go.mod h1:bwIC5TjrNG6QDCHNWvW4HLHtUQ4I+VQDsnjhvyZCALM= go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M= go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= From d7ae0099bf12f082dc376f4e1d1a5798d911639a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 14:44:05 +0000 Subject: [PATCH 087/123] Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 (#478) --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index e7e8d8cb..2392b0d6 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/go-openapi/strfmt v0.22.1 github.com/go-openapi/swag v0.22.5 github.com/go-openapi/validate v0.22.4 - github.com/stretchr/testify v1.8.4 + github.com/stretchr/testify v1.9.0 ) require ( diff --git a/go.sum b/go.sum index 497be505..c7de941e 100644 --- a/go.sum +++ b/go.sum @@ -90,8 +90,8 @@ github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDN github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80= go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= From d135f7f18ad9a029ea16f3b971f7285a208bc9fd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 14:58:05 +0000 Subject: [PATCH 088/123] Bump github.com/go-openapi/errors from 0.21.0 to 0.22.0 (#477) --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2392b0d6..a970e248 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/IBM/go-sdk-core/v5 v5.17.5 github.com/IBM/platform-services-go-sdk v0.69.2 github.com/apparentlymart/go-cidr v1.1.0 - github.com/go-openapi/errors v0.21.0 + github.com/go-openapi/errors v0.22.0 github.com/go-openapi/runtime v0.26.0 github.com/go-openapi/strfmt v0.22.1 github.com/go-openapi/swag v0.22.5 diff --git a/go.sum b/go.sum index c7de941e..abbe0df9 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-openapi/analysis v0.21.5 h1:3tHfEBh6Ia8eKc4M7khOGjPOAlWKJ10d877Cr9teujI= github.com/go-openapi/analysis v0.21.5/go.mod h1:25YcZosX9Lwz2wBsrFrrsL8bmjjXdlyP6zsr2AMy29M= -github.com/go-openapi/errors v0.21.0 h1:FhChC/duCnfoLj1gZ0BgaBmzhJC2SL/sJr8a2vAobSY= -github.com/go-openapi/errors v0.21.0/go.mod h1:jxNTMUxRCKj65yb/okJGEtahVd7uvWnuWfj53bse4ho= +github.com/go-openapi/errors v0.22.0 h1:c4xY/OLxUBSTiepAg3j/MHuAv5mJhnf53LLMWFB+u/w= +github.com/go-openapi/errors v0.22.0/go.mod h1:J3DmZScxCDufmIMsdOuDHxJbdOGC0xtUynjIx092vXE= github.com/go-openapi/jsonpointer v0.20.1 h1:MkK4VEIEZMj4wT9PmjaUmGflVBr9nvud4Q4UVFbDoBE= github.com/go-openapi/jsonpointer v0.20.1/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= github.com/go-openapi/jsonreference v0.20.3 h1:EjGcjTW8pD1mRis6+w/gmoBdqv5+RbE9B85D1NgDOVQ= From 07c93238a17ff31c7075c59c65d48d8e651f9e15 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Fri, 1 Mar 2024 13:31:05 -0600 Subject: [PATCH 089/123] Update swagger client and models to service-broker v1.140.0 (#337) * Generated Swagger client from service-broker commit f482db37dd0b38392de1f3aecdc2219212147830 * Fix build --------- Co-authored-by: michael kad --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d8f5e267..959c3c05 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v4 - + - name: Set up Go uses: actions/setup-go@v5 with: From 9729644fe8a2c3e0941b19e4fe40454207f344af Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Wed, 13 Mar 2024 10:42:12 -0500 Subject: [PATCH 090/123] Update swagger client and models to service-broker v1.140.0 (#346) * Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh * Update golangci-lint version and skip cache Signed-off-by: Yussuf Shaikh * Add branch to dependabot (#338) * Add branch to dependabot * Fix build * Generated Swagger client from service-broker commit 1db48bf5f665abf4e91c66d019aa231b913db3d9 --------- Signed-off-by: dependabot[bot] Signed-off-by: Yussuf Shaikh Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Yussuf Shaikh Co-authored-by: michaelkad <45772690+michaelkad@users.noreply.github.com> --- power/models/hostgroup_summary.go | 56 +++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 power/models/hostgroup_summary.go diff --git a/power/models/hostgroup_summary.go b/power/models/hostgroup_summary.go new file mode 100644 index 00000000..6112fd1d --- /dev/null +++ b/power/models/hostgroup_summary.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HostgroupSummary hostgroup summary +// +// swagger:model HostgroupSummary +type HostgroupSummary struct { + + // Whether the hostgroup is a primary or secondary hostgroup + Access string `json:"access,omitempty"` + + // Link to the hostgroup resource + Href string `json:"href,omitempty"` + + // Name of the hostgroup + Name string `json:"name,omitempty"` +} + +// Validate validates this hostgroup summary +func (m *HostgroupSummary) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this hostgroup summary based on context it is used +func (m *HostgroupSummary) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *HostgroupSummary) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HostgroupSummary) UnmarshalBinary(b []byte) error { + var res HostgroupSummary + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} From f8968956e3898a0e6adc26e1a1d42ce354e8d0f9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 02:29:29 +0000 Subject: [PATCH 091/123] Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] From c763ca54cfb64cafd47562fa20ccd6ea514bdcd3 Mon Sep 17 00:00:00 2001 From: Yussuf Shaikh Date: Mon, 4 Mar 2024 09:35:42 +0530 Subject: [PATCH 092/123] Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh --- .github/workflows/go.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 959c3c05..a683f780 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,6 +20,11 @@ jobs: with: go-version: '1.22' + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.20' + - name: Lint uses: golangci/golangci-lint-action@v5 with: From 4502bc0cfc2e1d274cfebd172e29572c7252acc8 Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Mon, 4 Mar 2024 08:14:06 -0600 Subject: [PATCH 093/123] Add branch to dependabot (#338) * Add branch to dependabot * Fix build From 9b9e3226c19a8f985104a7ffbd0468ca7a28bf24 Mon Sep 17 00:00:00 2001 From: Yussuf Shaikh Date: Wed, 13 Mar 2024 21:15:47 +0530 Subject: [PATCH 094/123] Remove duplicate go setup step (#348) --- .github/workflows/go.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index a683f780..959c3c05 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,11 +20,6 @@ jobs: with: go-version: '1.22' - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.20' - - name: Lint uses: golangci/golangci-lint-action@v5 with: From 1524fbe619b1d68b8925f601043e528481e5b321 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 02:29:29 +0000 Subject: [PATCH 095/123] Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] From 7301fef0cba0545dd4b554b165d1575540e3c35f Mon Sep 17 00:00:00 2001 From: Yussuf Shaikh Date: Mon, 4 Mar 2024 09:35:42 +0530 Subject: [PATCH 096/123] Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh --- .github/workflows/go.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 959c3c05..a683f780 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,6 +20,11 @@ jobs: with: go-version: '1.22' + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.20' + - name: Lint uses: golangci/golangci-lint-action@v5 with: From 50e39a005e8061a2a7988d05bc563b509bf88cab Mon Sep 17 00:00:00 2001 From: Yussuf Shaikh Date: Mon, 4 Mar 2024 09:35:42 +0530 Subject: [PATCH 097/123] Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh --- .github/workflows/go.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index a683f780..959c3c05 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,11 +20,6 @@ jobs: with: go-version: '1.22' - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.20' - - name: Lint uses: golangci/golangci-lint-action@v5 with: From 74a2b7c565b91083be387ecb9eae3d6076af806d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 02:29:29 +0000 Subject: [PATCH 098/123] Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] From 4a398774f8c651d1a1f0bb8e6411b9c6f71bdcc7 Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Mon, 4 Mar 2024 08:14:06 -0600 Subject: [PATCH 099/123] Add branch to dependabot (#338) * Add branch to dependabot * Fix build From 674f1958c8b1e1d09379ae0d4c6653b307120d9d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 02:29:29 +0000 Subject: [PATCH 100/123] Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] From 6b31d5c12704a21da9e80b203d78b23276771352 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 02:29:29 +0000 Subject: [PATCH 101/123] Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] From 2f15119235015e9859204b9bb7f67b35996e9806 Mon Sep 17 00:00:00 2001 From: Yussuf Shaikh Date: Mon, 4 Mar 2024 09:35:42 +0530 Subject: [PATCH 102/123] Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh --- .github/workflows/go.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 959c3c05..a683f780 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,6 +20,11 @@ jobs: with: go-version: '1.22' + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.20' + - name: Lint uses: golangci/golangci-lint-action@v5 with: From d2d05becaa86be0d1357605abb1db0f20585e044 Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Mon, 4 Mar 2024 08:14:06 -0600 Subject: [PATCH 103/123] Add branch to dependabot (#338) * Add branch to dependabot * Fix build From ace440359c05e15105eb1e82bc929276a13de79b Mon Sep 17 00:00:00 2001 From: Yussuf Shaikh Date: Wed, 13 Mar 2024 21:15:47 +0530 Subject: [PATCH 104/123] Remove duplicate go setup step (#348) --- .github/workflows/go.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index a683f780..959c3c05 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,11 +20,6 @@ jobs: with: go-version: '1.22' - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.20' - - name: Lint uses: golangci/golangci-lint-action@v5 with: From 8460911c104e7e6286e93e75752df6b0f2fe5bb2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 02:29:29 +0000 Subject: [PATCH 105/123] Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] From 167a414346d45261e2b70fe9d3d41bf3bbff7ad5 Mon Sep 17 00:00:00 2001 From: Yussuf Shaikh Date: Mon, 4 Mar 2024 09:35:42 +0530 Subject: [PATCH 106/123] Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh --- .github/workflows/go.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 959c3c05..a683f780 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,6 +20,11 @@ jobs: with: go-version: '1.22' + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.20' + - name: Lint uses: golangci/golangci-lint-action@v5 with: From cecda1970cfb7344f616f7983c52cc01e2f438c0 Mon Sep 17 00:00:00 2001 From: Yussuf Shaikh Date: Mon, 4 Mar 2024 09:35:42 +0530 Subject: [PATCH 107/123] Fix golangci-lint action v4 requirement Signed-off-by: Yussuf Shaikh --- .github/workflows/go.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index a683f780..959c3c05 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,11 +20,6 @@ jobs: with: go-version: '1.22' - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.20' - - name: Lint uses: golangci/golangci-lint-action@v5 with: From 2a8bc925d614ec8d3c1c141a0a6368349e06a9d4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 02:29:29 +0000 Subject: [PATCH 108/123] Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] From a95976ad9a1633c3ed1c57cf1de1b729883e5e5a Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Mon, 4 Mar 2024 08:14:06 -0600 Subject: [PATCH 109/123] Add branch to dependabot (#338) * Add branch to dependabot * Fix build From 2b3351e1d32cf253a803e456fa46308a97844e9e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 02:29:29 +0000 Subject: [PATCH 110/123] Bump github.com/IBM/go-sdk-core/v5 from 5.15.1 to 5.15.3 Bumps [github.com/IBM/go-sdk-core/v5](https://github.com/IBM/go-sdk-core) from 5.15.1 to 5.15.3. - [Release notes](https://github.com/IBM/go-sdk-core/releases) - [Changelog](https://github.com/IBM/go-sdk-core/blob/main/CHANGELOG.md) - [Commits](https://github.com/IBM/go-sdk-core/compare/v5.15.1...v5.15.3) --- updated-dependencies: - dependency-name: github.com/IBM/go-sdk-core/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] From 1324160d1c48cd3b013d9080fb4c2ee4491e655e Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Tue, 26 Mar 2024 08:30:07 -0500 Subject: [PATCH 111/123] Generated Swagger client from service-broker commit 70b0722398f5a64ea1e7bf1fbd07c6b3e7f8c9fc (#360) --- power/models/hostgroup_summary.go | 56 ------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 power/models/hostgroup_summary.go diff --git a/power/models/hostgroup_summary.go b/power/models/hostgroup_summary.go deleted file mode 100644 index 6112fd1d..00000000 --- a/power/models/hostgroup_summary.go +++ /dev/null @@ -1,56 +0,0 @@ -// 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" -) - -// HostgroupSummary hostgroup summary -// -// swagger:model HostgroupSummary -type HostgroupSummary struct { - - // Whether the hostgroup is a primary or secondary hostgroup - Access string `json:"access,omitempty"` - - // Link to the hostgroup resource - Href string `json:"href,omitempty"` - - // Name of the hostgroup - Name string `json:"name,omitempty"` -} - -// Validate validates this hostgroup summary -func (m *HostgroupSummary) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this hostgroup summary based on context it is used -func (m *HostgroupSummary) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *HostgroupSummary) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HostgroupSummary) UnmarshalBinary(b []byte) error { - var res HostgroupSummary - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} From 824e3627ab0a1481e28ad58bca037cc4a21f6a95 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Thu, 28 Mar 2024 09:03:36 -0500 Subject: [PATCH 112/123] Generated Swagger client from service-broker commit 384961399c43e0ea945615662e92396491168189 (#362) From 123a02f1fb205a955e423f43020efb989ddcc34c Mon Sep 17 00:00:00 2001 From: michaelkad <45772690+michaelkad@users.noreply.github.com> Date: Thu, 28 Mar 2024 10:05:13 -0500 Subject: [PATCH 113/123] Update Hostgroup client and add stratos validation (#361) * Update Hostgroup client and add stratos validation * Update name to hostGroup pattern * Rename file --- examples/hostgroups/main.go | 62 +++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 examples/hostgroups/main.go diff --git a/examples/hostgroups/main.go b/examples/hostgroups/main.go new file mode 100644 index 00000000..fbe1baeb --- /dev/null +++ b/examples/hostgroups/main.go @@ -0,0 +1,62 @@ +package main + +import ( + "context" + "log" + + v "github.com/IBM-Cloud/power-go-client/clients/instance" + ps "github.com/IBM-Cloud/power-go-client/ibmpisession" + "github.com/IBM/go-sdk-core/v5/core" +) + +func main() { + //session Inputs + // < IAM TOKEN > + // token := "" + apiKey := "" + region := " < REGION > " + zone := " < ZONE > " + accountID := " < ACCOUNT ID > " + url := region + ".power-iaas.test.cloud.ibm.com" + + // dr location inputs + piID := " < POWER INSTANCE ID > " + + // authenticator := &core.BearerTokenAuthenticator{ + // BearerToken: token, + // } + authenticator := &core.IamAuthenticator{ + ApiKey: apiKey, + // Uncomment for test environment + URL: "https://iam.test.cloud.ibm.com", + } + + // Create the session + options := &ps.IBMPIOptions{ + Authenticator: authenticator, + UserAccount: accountID, + Zone: zone, + URL: url, + Debug: true, + } + session, err := ps.NewIBMPISession(options) + if err != nil { + log.Fatal(err) + } + powerClient := v.NewIBMPHostgroupsClient(context.Background(), session, piID) + if err != nil { + log.Fatal(err) + } + + getAllAvailableHost, err := powerClient.GetAvailableHosts() + if err != nil { + log.Fatal(err) + } + log.Printf("***************[0]****************** %+v \n", getAllAvailableHost) + + getHostgroups, err := powerClient.GetHostGroups() + if err != nil { + log.Fatal(err) + } + log.Printf("***************[1]****************** %+v \n", getHostgroups) +} From 56d5b76a399a0094b95c0dd9d423cf885f5242a7 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Thu, 4 Apr 2024 09:26:39 -0500 Subject: [PATCH 114/123] Generated Swagger client from service-broker commit e43ad9dd41dd11d0210c10b8ffa0104e1b74afd0 (#371) --- power/models/s_a_p_profile.go | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/power/models/s_a_p_profile.go b/power/models/s_a_p_profile.go index 86d688a2..fef54859 100644 --- a/power/models/s_a_p_profile.go +++ b/power/models/s_a_p_profile.go @@ -46,6 +46,11 @@ type SAPProfile struct { // Enum: [4,8] SmtMode int64 `json:"smtMode"` + // Required smt mode for that profile + // Required: true + // Enum: [4 8] + SmtMode *int64 `json:"smtMode"` + // List of supported systems SupportedSystems []string `json:"supportedSystems"` @@ -82,6 +87,10 @@ func (m *SAPProfile) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateSmtMode(formats); err != nil { + res = append(res, err) + } + if err := m.validateType(formats); err != nil { res = append(res, err) } @@ -161,6 +170,40 @@ func (m *SAPProfile) validateSmtMode(formats strfmt.Registry) error { return nil } +var sAPProfileTypeSmtModePropEnum []interface{} + +func init() { + var res []int64 + if err := json.Unmarshal([]byte(`[4,8]`), &res); err != nil { + panic(err) + } + for _, v := range res { + sAPProfileTypeSmtModePropEnum = append(sAPProfileTypeSmtModePropEnum, v) + } +} + +// prop value enum +func (m *SAPProfile) validateSmtModeEnum(path, location string, value int64) error { + if err := validate.EnumCase(path, location, value, sAPProfileTypeSmtModePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *SAPProfile) validateSmtMode(formats strfmt.Registry) error { + + if err := validate.Required("smtMode", "body", m.SmtMode); err != nil { + return err + } + + // value enum + if err := m.validateSmtModeEnum("smtMode", "body", *m.SmtMode); err != nil { + return err + } + + return nil +} + var sAPProfileTypeTypePropEnum []interface{} func init() { From 2f2814472f378a45b9f40ab1a3aeba2084dd825c Mon Sep 17 00:00:00 2001 From: ismirlia <90468712+ismirlia@users.noreply.github.com> Date: Mon, 15 Apr 2024 15:09:13 -0500 Subject: [PATCH 115/123] Fix error in host-group example (#376) There appeared to be a typo in the client definition preventing the example from compiling. --- examples/hostgroups/main.go | 62 ------------------------------------- 1 file changed, 62 deletions(-) delete mode 100644 examples/hostgroups/main.go diff --git a/examples/hostgroups/main.go b/examples/hostgroups/main.go deleted file mode 100644 index fbe1baeb..00000000 --- a/examples/hostgroups/main.go +++ /dev/null @@ -1,62 +0,0 @@ -package main - -import ( - "context" - "log" - - v "github.com/IBM-Cloud/power-go-client/clients/instance" - ps "github.com/IBM-Cloud/power-go-client/ibmpisession" - "github.com/IBM/go-sdk-core/v5/core" -) - -func main() { - //session Inputs - // < IAM TOKEN > - // token := "" - apiKey := "" - region := " < REGION > " - zone := " < ZONE > " - accountID := " < ACCOUNT ID > " - url := region + ".power-iaas.test.cloud.ibm.com" - - // dr location inputs - piID := " < POWER INSTANCE ID > " - - // authenticator := &core.BearerTokenAuthenticator{ - // BearerToken: token, - // } - authenticator := &core.IamAuthenticator{ - ApiKey: apiKey, - // Uncomment for test environment - URL: "https://iam.test.cloud.ibm.com", - } - - // Create the session - options := &ps.IBMPIOptions{ - Authenticator: authenticator, - UserAccount: accountID, - Zone: zone, - URL: url, - Debug: true, - } - session, err := ps.NewIBMPISession(options) - if err != nil { - log.Fatal(err) - } - powerClient := v.NewIBMPHostgroupsClient(context.Background(), session, piID) - if err != nil { - log.Fatal(err) - } - - getAllAvailableHost, err := powerClient.GetAvailableHosts() - if err != nil { - log.Fatal(err) - } - log.Printf("***************[0]****************** %+v \n", getAllAvailableHost) - - getHostgroups, err := powerClient.GetHostGroups() - if err != nil { - log.Fatal(err) - } - log.Printf("***************[1]****************** %+v \n", getHostgroups) -} From 85a7e18349b1d57ce272af5934ee8b1a29e05410 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Mon, 17 Jun 2024 10:47:26 -0500 Subject: [PATCH 116/123] Generated Swagger client from service-broker commit 5fa65c3c11cd0c1479d3c3e135aa62c79cfd84bf (#405) From 096206ebc252f43afe64434aef2f42973c598b72 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Mon, 17 Jun 2024 10:48:33 -0500 Subject: [PATCH 117/123] Generated Swagger client from service-broker commit f856adaa7760209889781f329a122db016cc5587 (#408) From d09191f15f9b7ac6027d627fd77d869c6329b4e3 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Mon, 17 Jun 2024 10:48:52 -0500 Subject: [PATCH 118/123] Generated Swagger client from service-broker commit b7a20105660b86a198fa90be0e47093ac3ff9a5d (#409) From 50b6f9ec09c3c7012ddb4e38928c82d5a739311d Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Tue, 16 Jul 2024 12:01:28 -0500 Subject: [PATCH 119/123] Generated Swagger client from service-broker commit 35aa4910370044d82d24dad103292b5963600875 (#427) --- power/models/capability_details.go | 157 ++++++++++++++++++++++++++ power/models/replication_services.go | 159 +++++++++++++++++++++++++++ 2 files changed, 316 insertions(+) create mode 100644 power/models/capability_details.go create mode 100644 power/models/replication_services.go diff --git a/power/models/capability_details.go b/power/models/capability_details.go new file mode 100644 index 00000000..1b2c0f42 --- /dev/null +++ b/power/models/capability_details.go @@ -0,0 +1,157 @@ +// 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" +) + +// CapabilityDetails capability details +// +// swagger:model CapabilityDetails +type CapabilityDetails struct { + + // Disaster Recovery Information + // Required: true + DisasterRecovery *DisasterRecovery `json:"disasterRecovery"` + + // Datacenter System Types Information + // Required: true + SupportedSystems *SupportedSystems `json:"supportedSystems"` +} + +// Validate validates this capability details +func (m *CapabilityDetails) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDisasterRecovery(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSupportedSystems(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CapabilityDetails) validateDisasterRecovery(formats strfmt.Registry) error { + + if err := validate.Required("disasterRecovery", "body", m.DisasterRecovery); err != nil { + return err + } + + if m.DisasterRecovery != nil { + if err := m.DisasterRecovery.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("disasterRecovery") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("disasterRecovery") + } + return err + } + } + + return nil +} + +func (m *CapabilityDetails) validateSupportedSystems(formats strfmt.Registry) error { + + if err := validate.Required("supportedSystems", "body", m.SupportedSystems); err != nil { + return err + } + + if m.SupportedSystems != nil { + if err := m.SupportedSystems.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("supportedSystems") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("supportedSystems") + } + return err + } + } + + return nil +} + +// ContextValidate validate this capability details based on the context it is used +func (m *CapabilityDetails) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDisasterRecovery(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSupportedSystems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CapabilityDetails) contextValidateDisasterRecovery(ctx context.Context, formats strfmt.Registry) error { + + if m.DisasterRecovery != nil { + + if err := m.DisasterRecovery.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("disasterRecovery") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("disasterRecovery") + } + return err + } + } + + return nil +} + +func (m *CapabilityDetails) contextValidateSupportedSystems(ctx context.Context, formats strfmt.Registry) error { + + if m.SupportedSystems != nil { + + if err := m.SupportedSystems.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("supportedSystems") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("supportedSystems") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CapabilityDetails) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CapabilityDetails) UnmarshalBinary(b []byte) error { + var res CapabilityDetails + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/replication_services.go b/power/models/replication_services.go new file mode 100644 index 00000000..637125d0 --- /dev/null +++ b/power/models/replication_services.go @@ -0,0 +1,159 @@ +// 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" +) + +// ReplicationServices replication services +// +// swagger:model ReplicationServices +type ReplicationServices struct { + + // Asynchronous Replication Target Information + // Required: true + AsynchronousReplication *ReplicationService `json:"asynchronousReplication"` + + // Synchronous Replication Target Information + SynchronousReplication *ReplicationService `json:"synchronousReplication,omitempty"` +} + +// Validate validates this replication services +func (m *ReplicationServices) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAsynchronousReplication(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSynchronousReplication(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ReplicationServices) validateAsynchronousReplication(formats strfmt.Registry) error { + + if err := validate.Required("asynchronousReplication", "body", m.AsynchronousReplication); err != nil { + return err + } + + if m.AsynchronousReplication != nil { + if err := m.AsynchronousReplication.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("asynchronousReplication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("asynchronousReplication") + } + return err + } + } + + return nil +} + +func (m *ReplicationServices) validateSynchronousReplication(formats strfmt.Registry) error { + if swag.IsZero(m.SynchronousReplication) { // not required + return nil + } + + if m.SynchronousReplication != nil { + if err := m.SynchronousReplication.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("synchronousReplication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("synchronousReplication") + } + return err + } + } + + return nil +} + +// ContextValidate validate this replication services based on the context it is used +func (m *ReplicationServices) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAsynchronousReplication(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSynchronousReplication(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ReplicationServices) contextValidateAsynchronousReplication(ctx context.Context, formats strfmt.Registry) error { + + if m.AsynchronousReplication != nil { + + if err := m.AsynchronousReplication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("asynchronousReplication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("asynchronousReplication") + } + return err + } + } + + return nil +} + +func (m *ReplicationServices) contextValidateSynchronousReplication(ctx context.Context, formats strfmt.Registry) error { + + if m.SynchronousReplication != nil { + + if swag.IsZero(m.SynchronousReplication) { // not required + return nil + } + + if err := m.SynchronousReplication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("synchronousReplication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("synchronousReplication") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ReplicationServices) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ReplicationServices) UnmarshalBinary(b []byte) error { + var res ReplicationServices + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} From 5cd80856c9ba4d9ffa26cef151616008e16f8bb7 Mon Sep 17 00:00:00 2001 From: powervs-ibm <137309855+powervs-ibm@users.noreply.github.com> Date: Tue, 6 Aug 2024 17:29:35 -0500 Subject: [PATCH 120/123] Generated Swagger client from service-broker commit f82abb1277ab5b723c24869c6428d76919342fed (#438) --- power/models/capability_details.go | 157 -------------------------- power/models/replication_services.go | 159 --------------------------- 2 files changed, 316 deletions(-) delete mode 100644 power/models/capability_details.go delete mode 100644 power/models/replication_services.go diff --git a/power/models/capability_details.go b/power/models/capability_details.go deleted file mode 100644 index 1b2c0f42..00000000 --- a/power/models/capability_details.go +++ /dev/null @@ -1,157 +0,0 @@ -// 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" -) - -// CapabilityDetails capability details -// -// swagger:model CapabilityDetails -type CapabilityDetails struct { - - // Disaster Recovery Information - // Required: true - DisasterRecovery *DisasterRecovery `json:"disasterRecovery"` - - // Datacenter System Types Information - // Required: true - SupportedSystems *SupportedSystems `json:"supportedSystems"` -} - -// Validate validates this capability details -func (m *CapabilityDetails) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateDisasterRecovery(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSupportedSystems(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *CapabilityDetails) validateDisasterRecovery(formats strfmt.Registry) error { - - if err := validate.Required("disasterRecovery", "body", m.DisasterRecovery); err != nil { - return err - } - - if m.DisasterRecovery != nil { - if err := m.DisasterRecovery.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("disasterRecovery") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("disasterRecovery") - } - return err - } - } - - return nil -} - -func (m *CapabilityDetails) validateSupportedSystems(formats strfmt.Registry) error { - - if err := validate.Required("supportedSystems", "body", m.SupportedSystems); err != nil { - return err - } - - if m.SupportedSystems != nil { - if err := m.SupportedSystems.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("supportedSystems") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("supportedSystems") - } - return err - } - } - - return nil -} - -// ContextValidate validate this capability details based on the context it is used -func (m *CapabilityDetails) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateDisasterRecovery(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateSupportedSystems(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *CapabilityDetails) contextValidateDisasterRecovery(ctx context.Context, formats strfmt.Registry) error { - - if m.DisasterRecovery != nil { - - if err := m.DisasterRecovery.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("disasterRecovery") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("disasterRecovery") - } - return err - } - } - - return nil -} - -func (m *CapabilityDetails) contextValidateSupportedSystems(ctx context.Context, formats strfmt.Registry) error { - - if m.SupportedSystems != nil { - - if err := m.SupportedSystems.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("supportedSystems") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("supportedSystems") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *CapabilityDetails) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *CapabilityDetails) UnmarshalBinary(b []byte) error { - var res CapabilityDetails - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/power/models/replication_services.go b/power/models/replication_services.go deleted file mode 100644 index 637125d0..00000000 --- a/power/models/replication_services.go +++ /dev/null @@ -1,159 +0,0 @@ -// 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" -) - -// ReplicationServices replication services -// -// swagger:model ReplicationServices -type ReplicationServices struct { - - // Asynchronous Replication Target Information - // Required: true - AsynchronousReplication *ReplicationService `json:"asynchronousReplication"` - - // Synchronous Replication Target Information - SynchronousReplication *ReplicationService `json:"synchronousReplication,omitempty"` -} - -// Validate validates this replication services -func (m *ReplicationServices) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateAsynchronousReplication(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSynchronousReplication(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *ReplicationServices) validateAsynchronousReplication(formats strfmt.Registry) error { - - if err := validate.Required("asynchronousReplication", "body", m.AsynchronousReplication); err != nil { - return err - } - - if m.AsynchronousReplication != nil { - if err := m.AsynchronousReplication.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("asynchronousReplication") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("asynchronousReplication") - } - return err - } - } - - return nil -} - -func (m *ReplicationServices) validateSynchronousReplication(formats strfmt.Registry) error { - if swag.IsZero(m.SynchronousReplication) { // not required - return nil - } - - if m.SynchronousReplication != nil { - if err := m.SynchronousReplication.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("synchronousReplication") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("synchronousReplication") - } - return err - } - } - - return nil -} - -// ContextValidate validate this replication services based on the context it is used -func (m *ReplicationServices) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateAsynchronousReplication(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateSynchronousReplication(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *ReplicationServices) contextValidateAsynchronousReplication(ctx context.Context, formats strfmt.Registry) error { - - if m.AsynchronousReplication != nil { - - if err := m.AsynchronousReplication.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("asynchronousReplication") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("asynchronousReplication") - } - return err - } - } - - return nil -} - -func (m *ReplicationServices) contextValidateSynchronousReplication(ctx context.Context, formats strfmt.Registry) error { - - if m.SynchronousReplication != nil { - - if swag.IsZero(m.SynchronousReplication) { // not required - return nil - } - - if err := m.SynchronousReplication.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("synchronousReplication") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("synchronousReplication") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *ReplicationServices) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ReplicationServices) UnmarshalBinary(b []byte) error { - var res ReplicationServices - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} From a7d882d46405e67b9ad5930b440d0b00b9dd0029 Mon Sep 17 00:00:00 2001 From: Michael-Kadiayi Date: Wed, 9 Oct 2024 10:01:22 -0500 Subject: [PATCH 121/123] Add Virtual Serial Number --- clients/instance/ibm-pi-instance.go | 12 +++++ .../instance/ibm-pi-virtual-serial-number.go | 52 +++++++++++++++++++ power/models/s_a_p_profile.go | 43 --------------- 3 files changed, 64 insertions(+), 43 deletions(-) create mode 100644 clients/instance/ibm-pi-virtual-serial-number.go diff --git a/clients/instance/ibm-pi-instance.go b/clients/instance/ibm-pi-instance.go index 30d47c28..4d51878e 100644 --- a/clients/instance/ibm-pi-instance.go +++ b/clients/instance/ibm-pi-instance.go @@ -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-virtual-serial-number.go b/clients/instance/ibm-pi-virtual-serial-number.go new file mode 100644 index 00000000..6583f29e --- /dev/null +++ b/clients/instance/ibm-pi-virtual-serial-number.go @@ -0,0 +1,52 @@ +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() (models.VirtualSerialNumberList, error) { + params := p_cloud_virtual_serial_number.NewPcloudVirtualserialnumberGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut) + 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 +} diff --git a/power/models/s_a_p_profile.go b/power/models/s_a_p_profile.go index fef54859..86d688a2 100644 --- a/power/models/s_a_p_profile.go +++ b/power/models/s_a_p_profile.go @@ -46,11 +46,6 @@ type SAPProfile struct { // Enum: [4,8] SmtMode int64 `json:"smtMode"` - // Required smt mode for that profile - // Required: true - // Enum: [4 8] - SmtMode *int64 `json:"smtMode"` - // List of supported systems SupportedSystems []string `json:"supportedSystems"` @@ -87,10 +82,6 @@ func (m *SAPProfile) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateSmtMode(formats); err != nil { - res = append(res, err) - } - if err := m.validateType(formats); err != nil { res = append(res, err) } @@ -170,40 +161,6 @@ func (m *SAPProfile) validateSmtMode(formats strfmt.Registry) error { return nil } -var sAPProfileTypeSmtModePropEnum []interface{} - -func init() { - var res []int64 - if err := json.Unmarshal([]byte(`[4,8]`), &res); err != nil { - panic(err) - } - for _, v := range res { - sAPProfileTypeSmtModePropEnum = append(sAPProfileTypeSmtModePropEnum, v) - } -} - -// prop value enum -func (m *SAPProfile) validateSmtModeEnum(path, location string, value int64) error { - if err := validate.EnumCase(path, location, value, sAPProfileTypeSmtModePropEnum, true); err != nil { - return err - } - return nil -} - -func (m *SAPProfile) validateSmtMode(formats strfmt.Registry) error { - - if err := validate.Required("smtMode", "body", m.SmtMode); err != nil { - return err - } - - // value enum - if err := m.validateSmtModeEnum("smtMode", "body", *m.SmtMode); err != nil { - return err - } - - return nil -} - var sAPProfileTypeTypePropEnum []interface{} func init() { From 850979c4379dfb3314a68322535992c0fed35803 Mon Sep 17 00:00:00 2001 From: Michael-Kadiayi Date: Wed, 9 Oct 2024 10:28:35 -0500 Subject: [PATCH 122/123] Remove space --- .github/workflows/go.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 959c3c05..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: From 7c373c9ea5471441bba825092b10d3e4b81149e5 Mon Sep 17 00:00:00 2001 From: Michael-Kadiayi Date: Thu, 10 Oct 2024 08:28:48 -0500 Subject: [PATCH 123/123] Add ID to getall VSN --- clients/instance/ibm-pi-virtual-serial-number.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/clients/instance/ibm-pi-virtual-serial-number.go b/clients/instance/ibm-pi-virtual-serial-number.go index 6583f29e..648786f7 100644 --- a/clients/instance/ibm-pi-virtual-serial-number.go +++ b/clients/instance/ibm-pi-virtual-serial-number.go @@ -38,9 +38,12 @@ func (f *IBMPIVSNClient) Get(id string) (*models.VirtualSerialNumber, error) { } // Get All Virtual Serial Numbers -func (f *IBMPIVSNClient) GetAll() (models.VirtualSerialNumberList, error) { +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))